From bc61043b1393a2083bec58731faaa87764da22ee Mon Sep 17 00:00:00 2001 From: Abdelrahman Awad Date: Thu, 28 May 2026 15:32:05 +0200 Subject: [PATCH] chore: switch package builds to rolldown Co-Authored-By: Codex --- .../ContextLines/noAddedLines/test.ts | 5 +- .../moduleMetadata/appliesMetadata/test.ts | 6 +- .../appliesMetadataWithRewriteFrames/test.ts | 6 +- .../nextjs-15-t3/next.config.js | 6 +- .../nextjs-15-t3/package.json | 1 - .../nextjs-orpc/next.config.js | 4 +- .../nextjs-orpc/package.json | 1 - .../sveltekit-2/vite.config.js | 5 + .../node-integration-tests/package.json | 2 +- dev-packages/rollup-utils/bundleHelpers.mjs | 65 +++-- dev-packages/rollup-utils/index.mjs | 2 +- dev-packages/rollup-utils/npmHelpers.mjs | 56 ++-- .../rollup-utils/plugins/bundlePlugins.mjs | 223 ++++++-------- .../rollup-utils/plugins/make-esm-plugin.mjs | 7 +- .../rollup-utils/plugins/npmPlugins.mjs | 80 +---- dev-packages/rollup-utils/utils.mjs | 65 +++-- dev-packages/test-utils/package.json | 2 +- package.json | 8 +- packages/astro/package.json | 5 +- packages/aws-serverless/package.json | 9 +- packages/aws-serverless/rollup.npm.config.mjs | 2 +- packages/browser-utils/package.json | 9 +- .../test/performance/elementTiming.test.ts | 11 +- packages/browser/package.json | 13 +- packages/bun/package.json | 5 +- .../integrations/bunRuntimeMetrics.test.ts | 67 +++-- packages/bundler-plugins/package.json | 4 +- .../bundler-plugins/rollup.npm.config.mjs | 12 +- packages/cloudflare/package.json | 5 +- packages/core/package.json | 5 +- packages/core/rollup.npm.config.mjs | 12 +- packages/deno/package.json | 2 +- packages/deno/rollup.npm.config.mjs | 2 +- packages/effect/package.json | 4 +- packages/effect/test/metrics.test.ts | 37 +-- packages/elysia/package.json | 4 +- packages/eslint-config-sdk/src/base.js | 2 + packages/feedback/package.json | 4 +- packages/feedback/rollup.bundle.config.mjs | 22 +- packages/feedback/rollup.npm.config.mjs | 5 - packages/gatsby/package.json | 5 +- packages/google-cloud-serverless/package.json | 5 +- packages/hono/package.json | 4 +- packages/integration-shims/package.json | 2 +- packages/nestjs/package.json | 5 +- packages/nextjs/rollup.npm.config.mjs | 37 ++- packages/nextjs/scripts/buildRollup.ts | 2 +- .../templates/routeHandlerWrapperTemplate.ts | 4 +- .../templates/sentryInitWrapperTemplate.ts | 7 +- packages/nitro/package.json | 4 +- packages/node-native/package.json | 7 +- packages/node/package.json | 5 +- packages/node/rollup.npm.config.mjs | 32 +- .../fs/vendored/instrumentation.ts | 6 +- .../integrations/nodeRuntimeMetrics.test.ts | 86 +++--- packages/nuxt/package.json | 7 +- packages/nuxt/rollup.module.config.mjs | 21 +- packages/opentelemetry/package.json | 5 +- packages/profiling-node/package.json | 7 +- packages/react-router/package.json | 5 +- packages/react/package.json | 5 +- packages/remix/package.json | 5 +- packages/replay-canvas/package.json | 4 +- packages/replay-canvas/src/canvas.ts | 2 +- packages/replay-canvas/test/canvas.test.ts | 4 +- packages/replay-internal/package.json | 4 +- .../replay-internal/rollup.npm.config.mjs | 8 +- packages/replay-worker/package.json | 4 +- .../replay-worker/rollup.examples.config.mjs | 30 +- .../replay-worker/rollup.worker.config.mjs | 56 ++-- packages/replay-worker/tsconfig.build.json | 11 + packages/replay-worker/tsconfig.json | 5 +- packages/server-utils/package.json | 4 +- packages/server-utils/rollup.npm.config.mjs | 98 +++++-- packages/solid/package.json | 5 +- packages/solidstart/package.json | 5 +- packages/svelte/package.json | 5 +- packages/sveltekit/package.json | 5 +- packages/tanstackstart-react/package.json | 2 +- packages/vercel-edge/package.json | 5 +- packages/vercel-edge/rollup.npm.config.mjs | 16 +- packages/vue/package.json | 9 +- packages/wasm/package.json | 13 +- yarn.lock | 276 ++++++------------ 84 files changed, 800 insertions(+), 822 deletions(-) create mode 100644 packages/replay-worker/tsconfig.build.json diff --git a/dev-packages/browser-integration-tests/suites/integrations/ContextLines/noAddedLines/test.ts b/dev-packages/browser-integration-tests/suites/integrations/ContextLines/noAddedLines/test.ts index 51e2a7ee7517..880c5ff0e8b4 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/ContextLines/noAddedLines/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/ContextLines/noAddedLines/test.ts @@ -16,7 +16,10 @@ sentryTest('should not add source context lines to errors from script files', as const exception = eventData.exception?.values?.[0]; const frames = exception?.stacktrace?.frames; - expect(frames).toHaveLength(1); + expect(frames?.length).toBeGreaterThanOrEqual(1); + // Verify the subject.bundle.js frame is present + expect(frames?.some(f => f.filename?.includes('subject.bundle.js'))).toBe(true); + // Core assertion: no context lines should be added for script files frames?.forEach(f => { expect(f).not.toHaveProperty('pre_context'); expect(f).not.toHaveProperty('context_line'); diff --git a/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadata/test.ts b/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadata/test.ts index 35a0cffeb13c..697da77aa512 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadata/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadata/test.ts @@ -7,5 +7,9 @@ sentryTest('should provide module_metadata on stack frames in beforeSend', async const url = await getLocalTestUrl({ testDir: __dirname }); const errorEvent = await getFirstSentryEnvelopeRequest(page, url); - expect(errorEvent.extra?.['module_metadata_entries']).toEqual([{ foo: 'bar' }]); + // Filter out null entries from internal Sentry frames that don't have module metadata + const metadataEntries = (errorEvent.extra?.['module_metadata_entries'] as Array)?.filter( + entry => entry !== null, + ); + expect(metadataEntries).toEqual([{ foo: 'bar' }]); }); diff --git a/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadataWithRewriteFrames/test.ts b/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadataWithRewriteFrames/test.ts index 296e76c219c5..41634d3edc63 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadataWithRewriteFrames/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadataWithRewriteFrames/test.ts @@ -9,6 +9,10 @@ sentryTest( const url = await getLocalTestUrl({ testDir: __dirname }); const errorEvent = await getFirstSentryEnvelopeRequest(page, url); - expect(errorEvent?.extra?.['module_metadata_entries']).toEqual([{ foo: 'baz' }]); + // Filter out null entries from internal Sentry frames that don't have module metadata + const metadataEntries = (errorEvent?.extra?.['module_metadata_entries'] as Array)?.filter( + entry => entry !== null, + ); + expect(metadataEntries).toEqual([{ foo: 'baz' }]); }, ); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/next.config.js b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/next.config.js index a1ec081d7e72..a141320e9c87 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/next.config.js +++ b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/next.config.js @@ -1,11 +1,11 @@ -await import('./src/env.js'); +require('./src/env.js'); /** @type {import("next").NextConfig} */ const config = {}; -import { withSentryConfig } from '@sentry/nextjs'; +const { withSentryConfig } = require('@sentry/nextjs'); -export default withSentryConfig(config, { +module.exports = withSentryConfig(config, { webpack: { treeshake: { removeDebugLogging: true, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/package.json b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/package.json index 24fde175baea..eabb99fde70d 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15-t3/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-15-t3/package.json @@ -2,7 +2,6 @@ "name": "t3", "version": "0.1.0", "private": true, - "type": "module", "scripts": { "build": "next build", "clean": "npx rimraf node_modules pnpm-lock.yaml", diff --git a/dev-packages/e2e-tests/test-applications/nextjs-orpc/next.config.js b/dev-packages/e2e-tests/test-applications/nextjs-orpc/next.config.js index 54723b889027..e9bddb12af21 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-orpc/next.config.js +++ b/dev-packages/e2e-tests/test-applications/nextjs-orpc/next.config.js @@ -1,9 +1,9 @@ /** @type {import("next").NextConfig} */ const config = {}; -import { withSentryConfig } from '@sentry/nextjs'; +const { withSentryConfig } = require('@sentry/nextjs'); -export default withSentryConfig(config, { +module.exports = withSentryConfig(config, { webpack: { treeshake: { removeDebugLogging: true, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-orpc/package.json b/dev-packages/e2e-tests/test-applications/nextjs-orpc/package.json index 21f835e2ecd4..aaffea8e1400 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-orpc/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-orpc/package.json @@ -2,7 +2,6 @@ "name": "next-orpc", "version": "0.1.0", "private": true, - "type": "module", "scripts": { "build": "next build", "dev": "next dev -p 3030", diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/vite.config.js b/dev-packages/e2e-tests/test-applications/sveltekit-2/vite.config.js index be8b485d022a..a09e14f44adc 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/vite.config.js +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/vite.config.js @@ -9,4 +9,9 @@ export default defineConfig({ }), sveltekit(), ], + build: { + rollupOptions: { + external: ['fsevents'], + }, + }, }); diff --git a/dev-packages/node-integration-tests/package.json b/dev-packages/node-integration-tests/package.json index 914512fcd27d..5d6c5fbfdbfe 100644 --- a/dev-packages/node-integration-tests/package.json +++ b/dev-packages/node-integration-tests/package.json @@ -12,7 +12,7 @@ "scripts": { "build": "run-s build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "clean": "rimraf -g suites/**/node_modules suites/**/tmp_* && run-p clean:script", "clean:script": "node scripts/clean.js", diff --git a/dev-packages/rollup-utils/bundleHelpers.mjs b/dev-packages/rollup-utils/bundleHelpers.mjs index 6ac5f6aff06d..04a6a8a68f77 100644 --- a/dev-packages/rollup-utils/bundleHelpers.mjs +++ b/dev-packages/rollup-utils/bundleHelpers.mjs @@ -1,48 +1,42 @@ /** - * Rollup config docs: https://rollupjs.org/guide/en/#big-list-of-options + * Rolldown config docs: https://rolldown.rs/reference/config-options */ -import { builtinModules } from 'module'; +import * as fs from 'fs'; +import * as path from 'path'; import deepMerge from 'deepmerge'; import { + makeBannerOptions, makeBrowserBuildPlugin, - makeCommonJSPlugin, - makeEsbuildPlugin, makeIsDebugBuildPlugin, - makeLicensePlugin, - makeNodeResolvePlugin, + makeMinifierOptions, makeRrwebBuildPlugin, makeSetSDKSourcePlugin, - makeTerserPlugin, } from './plugins/index.mjs'; -import { mergePlugins } from './utils.mjs'; +import { getNodeBuiltIns, mergePlugins, treeShakePreset } from './utils.mjs'; import { makeProductionReplacePlugin } from './plugins/npmPlugins.mjs'; const BUNDLE_VARIANTS = ['.js', '.min.js', '.debug.min.js']; +const packageDotJSON = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' })); + export function makeBaseBundleConfig(options) { - const { bundleType, entrypoints, licenseTitle, outputFileBase, packageSpecificConfig, esbuild } = options; + const { bundleType, entrypoints, licenseTitle, outputFileBase, packageSpecificConfig } = options; - const nodeResolvePlugin = makeNodeResolvePlugin(); - const transpilePlugin = makeEsbuildPlugin(esbuild); const markAsBrowserBuildPlugin = makeBrowserBuildPlugin(true); - const licensePlugin = makeLicensePlugin(licenseTitle); + const banner = makeBannerOptions(licenseTitle, packageDotJSON.version); const rrwebBuildPlugin = makeRrwebBuildPlugin({ excludeIframe: false, excludeShadowDom: false, }); const productionReplacePlugin = makeProductionReplacePlugin(); - // The `commonjs` plugin is the `esModuleInterop` of the bundling world. When used with `transformMixedEsModules`, it - // will include all dependencies, imported or required, in the final bundle. (Without it, CJS modules aren't included - // at all, and without `transformMixedEsModules`, they're only included if they're imported, not if they're required.) - const commonJSPlugin = makeCommonJSPlugin({ transformMixedEsModules: true }); - // used by `@sentry/browser` const standAloneBundleConfig = { output: { + banner, format: 'iife', name: 'Sentry', intro: () => { @@ -50,7 +44,7 @@ export function makeBaseBundleConfig(options) { }, }, context: 'window', - plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin, licensePlugin], + plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin], }; // used by `@sentry/wasm` & pluggable integrations from core/browser (bundles which need to be combined with a stand-alone SDK bundle) @@ -61,7 +55,7 @@ export function makeBaseBundleConfig(options) { format: 'cjs', // code to add before the CJS wrapper - banner: '(function (__window) {', + banner: `${banner}\n(function (__window) {`, // code to add just inside the CJS wrapper, before any of the wrapped code intro: 'var exports = {};', @@ -84,30 +78,41 @@ export function makeBaseBundleConfig(options) { // code to add after the CJS wrapper footer: '}(window));', }, - plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin, licensePlugin], + plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin], }; const workerBundleConfig = { output: { + banner, format: 'esm', + minify: makeMinifierOptions(), }, - plugins: [commonJSPlugin, makeTerserPlugin(), licensePlugin], // Don't bundle any of Node's core modules - external: builtinModules, + external: getNodeBuiltIns(), }; const awsLambdaExtensionBundleConfig = { output: { format: 'esm', + minify: makeMinifierOptions(), }, - plugins: [commonJSPlugin, makeIsDebugBuildPlugin(true), makeTerserPlugin()], + plugins: [makeIsDebugBuildPlugin(true)], // Don't bundle any of Node's core modules - external: builtinModules, + external: getNodeBuiltIns(), }; // used by all bundles const sharedBundleConfig = { input: entrypoints, + + // Point at the package's tsconfig so rolldown picks up its TypeScript & JSX settings. + tsconfig: path.resolve(process.cwd(), './tsconfig.json'), + + // ES2020 is our floor: keeps `?.`/`??` native and downlevels everything newer. + transform: { + target: 'es2020', + }, + output: { // a file extension will be added to this base value when we specify either a minified or non-minified build entryFileNames: outputFileBase, @@ -116,8 +121,8 @@ export function makeBaseBundleConfig(options) { strict: false, esModule: false, }, - plugins: [productionReplacePlugin, transpilePlugin, nodeResolvePlugin], - treeshake: 'smallest', + plugins: [productionReplacePlugin], + treeshake: treeShakePreset('smallest'), }; const bundleTypeConfigMap = { @@ -147,7 +152,7 @@ export function makeBundleConfigVariants(baseConfig, options = {}) { const includeDebuggingPlugin = makeIsDebugBuildPlugin(true); const stripDebuggingPlugin = makeIsDebugBuildPlugin(false); - const terserPlugin = makeTerserPlugin(); + const minify = makeMinifierOptions(); const setSdkSourcePlugin = makeSetSDKSourcePlugin('cdn'); // The additional options to use for each variant we're going to create. @@ -162,15 +167,17 @@ export function makeBundleConfigVariants(baseConfig, options = {}) { '.min.js': { output: { entryFileNames: chunkInfo => `${baseConfig.output.entryFileNames(chunkInfo)}.min.js`, + minify, }, - plugins: [stripDebuggingPlugin, setSdkSourcePlugin, terserPlugin], + plugins: [stripDebuggingPlugin, setSdkSourcePlugin], }, '.debug.min.js': { output: { entryFileNames: chunkInfo => `${baseConfig.output.entryFileNames(chunkInfo)}.debug.min.js`, + minify, }, - plugins: [includeDebuggingPlugin, setSdkSourcePlugin, terserPlugin], + plugins: [includeDebuggingPlugin, setSdkSourcePlugin], }, }; diff --git a/dev-packages/rollup-utils/index.mjs b/dev-packages/rollup-utils/index.mjs index 2d8c9a2150bc..26ae2c0a1f96 100644 --- a/dev-packages/rollup-utils/index.mjs +++ b/dev-packages/rollup-utils/index.mjs @@ -4,4 +4,4 @@ export { plugins }; export * from './bundleHelpers.mjs'; export * from './npmHelpers.mjs'; -export { insertAt } from './utils.mjs'; +export { insertAt, treeShakePreset } from './utils.mjs'; diff --git a/dev-packages/rollup-utils/npmHelpers.mjs b/dev-packages/rollup-utils/npmHelpers.mjs index 064dd6f4e8e9..fd3783a0c77e 100644 --- a/dev-packages/rollup-utils/npmHelpers.mjs +++ b/dev-packages/rollup-utils/npmHelpers.mjs @@ -1,27 +1,24 @@ // @ts-check /** - * Rollup config docs: https://rollupjs.org/guide/en/#big-list-of-options + * Rolldown config docs: https://rolldown.rs/reference/config-options */ import * as fs from 'fs'; -import { builtinModules } from 'module'; import * as path from 'path'; import { fileURLToPath } from 'url'; import deepMerge from 'deepmerge'; -import { defineConfig } from 'rollup'; +import { defineConfig } from 'rolldown'; import { makeDebugBuildStatementReplacePlugin, - makeEsbuildPlugin, makeEsmCjsReplacePlugin, - makeNodeResolvePlugin, makeProductionReplacePlugin, makeRrwebBuildPlugin, } from './plugins/index.mjs'; import { makePackageNodeEsm } from './plugins/make-esm-plugin.mjs'; -import { mergeExternals, mergePlugins } from './utils.mjs'; +import { getNodeBuiltIns, mergeExternals, mergePlugins } from './utils.mjs'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -34,12 +31,9 @@ export function makeBaseNPMConfig(options = {}) { entrypoints = ['src/index.ts'], hasBundles = false, packageSpecificConfig = {}, - esbuild = {}, bundledBuiltins = [], } = options; - const nodeResolvePlugin = makeNodeResolvePlugin(); - const transpilePlugin = makeEsbuildPlugin(esbuild); const debugBuildStatementReplacePlugin = makeDebugBuildStatementReplacePlugin(); const rrwebBuildPlugin = makeRrwebBuildPlugin({ excludeShadowDom: undefined, @@ -47,7 +41,7 @@ export function makeBaseNPMConfig(options = {}) { }); const deps = [ - ...builtinModules.filter(m => !bundledBuiltins.includes(m)), + ...getNodeBuiltIns(bundledBuiltins), ...Object.keys(packageDotJSON.dependencies || {}), ...Object.keys(packageDotJSON.peerDependencies || {}), ...Object.keys(packageDotJSON.optionalDependencies || {}), @@ -56,6 +50,22 @@ export function makeBaseNPMConfig(options = {}) { const defaultBaseConfig = { input: entrypoints, + // Point at the package's tsconfig so rolldown picks up its TypeScript & JSX settings. + tsconfig: path.resolve(process.cwd(), './tsconfig.json'), + + // NOTE: we deliberately leave `platform` unset so rolldown infers it from the output format + // ('node' for cjs, 'browser' for everything else). Every explicit value breaks something: + // 'node' injects `import "node:module"` into each runtime chunk, which webpack rejects for + // browser targets; 'neutral' rewrites `import.meta` to `{}`, so `createRequire(import.meta.url)` + // gets `undefined`. Node-only packages that need the node platform for both halves set it + // themselves (see server-utils and bundler-plugins). + + // ES2020 is our floor: keeps `?.`/`??` native and downlevels everything newer. Packages that + // need more (e.g. top-level await) raise it through `packageSpecificConfig`. + transform: { + target: 'es2020', + }, + output: { // an appropriately-named directory will be added to this base value when we specify either a cjs or esm build dir: hasBundles ? 'build/npm' : 'build', @@ -67,6 +77,7 @@ export function makeBaseNPMConfig(options = {}) { // output individual files rather than one big bundle preserveModules: true, + preserveModulesRoot: 'src', // Don't hoist imports into entrypoints // should be ignored when `preserveModules` is used, @@ -89,19 +100,17 @@ export function makeBaseNPMConfig(options = {}) { // get: () => are.great, // }); externalLiveBindings: false, - - // Don't call `Object.freeze` on the results of `import * as someModule from '...'` - // (We don't need it, so why waste the bytes?) - freeze: false, - - // Assume externals are ESM-shaped (`__esModule` + `.default`), which our own `@sentry/*` - // packages satisfy via `esModule: 'if-default-prop'`. This keeps `import * as x` a live - // reference to the real module rather than an `_interopNamespace` copy — instrumentation code - // relies on that to monkey-patch modules like `fs` in place. Packages that pull in bare-CJS - // third-party deps (no `.default`) override this per-module (see server-utils). - interop: 'esModule', }, + // NOTE: rolldown has no equivalent of rollup's `output.interop`. In the CJS build it wraps + // namespace imports of externals as `x = __toESM(require('x'))`, and `__toESM` returns a copy + // whose properties are getter-only forwarders. Reads pass through to the real module but writes + // do not, so code that monkey-patches a module in place has to default-import it (`import x + // from 'x'`, whose `.default` is the live `require()` result) rather than namespace-import it. + // Rolldown errors on a statically visible `ns.foo = ...` (ASSIGN_TO_IMPORT), but it cannot see a + // write made through a helper, and that one fails silently. See + // `packages/node/src/integrations/fs/vendored/instrumentation.ts`. + treeshake: { moduleSideEffects: (id, external) => { if (external === false && ignoreSideEffects.test(id)) { @@ -119,7 +128,7 @@ export function makeBaseNPMConfig(options = {}) { }, }, - plugins: [nodeResolvePlugin, transpilePlugin, debugBuildStatementReplacePlugin, rrwebBuildPlugin], + plugins: [debugBuildStatementReplacePlugin, rrwebBuildPlugin], // don't include imported modules from outside the package in the final output // also treat subpath exports (e.g. `@sentry/core/browser`) as external @@ -181,8 +190,7 @@ export function makeNPMConfigVariants(baseConfig, options = {}) { } return variantSpecificConfigs.map(variant => - // Plugin arrays must be merged in the right order or the build silently misbehaves - // (e.g. esbuild strips dev-mode marker comments before the replace plugin can act). + // Plugin arrays must be merged in the right order or the build silently misbehaves. deepMerge(baseConfig, variant, { customMerge: key => (key === 'plugins' ? mergePlugins : undefined), }), diff --git a/dev-packages/rollup-utils/plugins/bundlePlugins.mjs b/dev-packages/rollup-utils/plugins/bundlePlugins.mjs index 23aab90f4edf..133240b0dcfd 100644 --- a/dev-packages/rollup-utils/plugins/bundlePlugins.mjs +++ b/dev-packages/rollup-utils/plugins/bundlePlugins.mjs @@ -1,173 +1,144 @@ /** - * CommonJS plugin docs: https://github.com/rollup/plugins/tree/master/packages/commonjs - * License plugin docs: https://github.com/mjeanroy/rollup-plugin-license - * Replace plugin docs: https://github.com/rollup/plugins/tree/master/packages/replace - * Resolve plugin docs: https://github.com/rollup/plugins/tree/master/packages/node-resolve - * Terser plugin docs: https://github.com/TrySound/rollup-plugin-terser#options - * Terser docs: https://github.com/terser/terser#api-reference - * Typescript plugin docs: https://github.com/rollup/plugins/tree/master/packages/typescript/#readme + * Replace plugin docs: https://rolldown.rs/builtin-plugins/replace#replace-plugin + * Minifier options docs: https://rolldown.rs/options/output-options#output-minify */ import * as childProcess from 'child_process'; - -import commonjs from '@rollup/plugin-commonjs'; -import { nodeResolve } from '@rollup/plugin-node-resolve'; -import replace from '@rollup/plugin-replace'; -import terser from '@rollup/plugin-terser'; -import license from 'rollup-plugin-license'; +import { replacePlugin } from 'rolldown/plugins'; /** - * Create a plugin to add an identification banner to the top of stand-alone bundles. + * Build the identification banner that goes at the top of stand-alone bundles. + * + * Rolldown emits banners itself (`output.banner`), so unlike `rollup-plugin-license` this returns + * the banner text rather than a plugin, and ordering against the minifier is no longer our problem. * * @param title The title to use for the SDK, if not the package name - * @returns An instance of the `rollup-plugin-license` plugin + * @param version The version of the SDK */ -export function makeLicensePlugin(title) { +export function makeBannerOptions(title, version) { const commitHash = childProcess.execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).trim(); - const plugin = license({ - banner: { - content: `/*! <%= data.title %> <%= pkg.version %> (${commitHash}) | https://github.com/getsentry/sentry-javascript */`, - data: { title }, - }, - }); - - // give it a nicer name for later, when we'll need to sort the plugins - plugin.name = 'license'; - - return plugin; + return `/*! ${title} ${version} (${commitHash}) | https://github.com/getsentry/sentry-javascript */`; } /** * Create a plugin to set the value of the `__SENTRY_DEBUG__` magic string. * * @param includeDebugging Whether or not the resulting build should include log statements - * @returns An instance of the `@rollup/plugin-replace` plugin to do the replacement of the magic string with `true` or - * 'false` + * @returns A `rolldown` replace plugin instance to do the replacement of the magic string with `true` or `false` */ export function makeIsDebugBuildPlugin(includeDebugging) { - const plugin = replace({ - // TODO `preventAssignment` will default to true in version 5.x of the replace plugin, at which point we can get rid - // of this. (It actually makes no difference in this case whether it's true or false, since we never assign to - // `__SENTRY_DEBUG__`, but if we don't give it a value, it will spam with warnings.) - preventAssignment: true, - values: { + return replacePlugin( + { // Flags in current package - __DEBUG_BUILD__: includeDebugging, + __DEBUG_BUILD__: JSON.stringify(includeDebugging), // Flags in built monorepo dependencies, from which the bundle pulls - __SENTRY_DEBUG__: includeDebugging, + __SENTRY_DEBUG__: JSON.stringify(includeDebugging), + }, + { + // It makes no difference in this case whether it's true or false, since we never assign to + // `__SENTRY_DEBUG__`, but if we don't give it a value, it will spam with warnings. + preventAssignment: true, }, - }); - plugin.name = 'replace-debug-flags'; - return plugin; + ); } /** * Replaces the comment marker `/*! __SENTRY_SDK_SOURCE__ *\/` in core's `getSDKSource()` with a * `return '';` statement so the bundle reports the correct distribution channel. * - * The marker uses the `/*! ... *\/` legal-comment syntax so it survives esbuild's transpile - * (esbuild strips ordinary block comments). The plugin sort order in utils.mjs also pins - * this name before `esbuild`, in case it ever runs on un-transpiled source directly. + * The marker uses the `/*! ... *\/` legal-comment syntax so it survives rolldown's transpile + * (ordinary block comments are stripped). */ export function makeSetSDKSourcePlugin(sdkSource) { - const plugin = replace({ - preventAssignment: false, - delimiters: ['', ''], - values: { + return replacePlugin( + { '/*! __SENTRY_SDK_SOURCE__ */': `return ${JSON.stringify(sdkSource)};`, }, - }); - plugin.name = 'replace-sdk-source'; - return plugin; + { + preventAssignment: false, + delimiters: ['', ''], + }, + ); } /** * Create a plugin to set the value of the `__SENTRY_BROWSER_BUNDLE__` magic string. * * @param isBrowserBuild Whether or not the resulting build will be run in the browser - * @returns An instance of the `replace` plugin to do the replacement of the magic string with `true` or 'false` + * @returns A `rolldown` replace plugin instance to do the replacement of the magic string with `true` or `false` */ export function makeBrowserBuildPlugin(isBrowserBuild) { - const plugin = replace({ - // TODO This will be the default in the next version of the `replace` plugin - preventAssignment: true, - values: { - __SENTRY_BROWSER_BUNDLE__: isBrowserBuild, + return replacePlugin( + { + __SENTRY_BROWSER_BUNDLE__: JSON.stringify(!!isBrowserBuild), + // Bundled dependencies (e.g. Preact in the feedback bundles) branch on this, and there is no + // CommonJS plugin left to fold it away for us. + 'process.env.NODE_ENV': JSON.stringify('production'), + }, + { + preventAssignment: true, }, - }); - plugin.name = 'replace-browser-bundle-flag'; - return plugin; + ); } -// `terser` options reference: https://github.com/terser/terser#api-reference -// `rollup-plugin-terser` options reference: https://github.com/TrySound/rollup-plugin-terser#options - /** - * Create a plugin to perform minification using `terser`. + * Minifier settings for the bundle builds. + * + * Rolldown minifies via oxc rather than terser, and oxc cannot mangle property names yet + * (https://github.com/oxc-project/oxc/issues/15375), so there is nothing to configure and no + * reserved list to protect. The list terser used to be given is kept below for whenever oxc grows + * the option, since every entry on it is load-bearing at runtime. * - * @returns An instance of the `terser` plugin + * @returns {import('rolldown').OutputOptions['minify']} */ -export function makeTerserPlugin() { - return terser({ - mangle: { - // `captureException` and `captureMessage` are public API methods and they don't need to be listed here, as the - // mangler won't touch user-facing things, but `sentryWrapped` is not user-facing, and would be mangled during - // minification. (We need it in its original form to correctly detect our internal frames for stripping.) All three - // are all listed here just for the clarity's sake, as they are all used in the frames manipulation process. - reserved: ['captureException', 'captureMessage', 'sentryWrapped'], - properties: { - // allow mangling of private field names... - regex: /^_[^_]/, - reserved: [ - // ...except for `_experiments`, which we want to remain usable from the outside - '_experiments', - // We want to keep some replay fields unmangled to enable integration tests to access them - '_replay', - '_canvas', - // We also can't mangle rrweb private fields when bundling rrweb in the replay CDN bundles - '_cssText', - // We want to keep the _integrations variable unmangled to send all installed integrations from replay - '_integrations', - // _meta is used to store metadata of replay network events - '_meta', - // We store SDK metadata in the options - '_metadata', - // Object we inject debug IDs into with bundler plugins - '_sentryDebugIds', - // These are used by instrument.ts in utils for identifying HTML elements & events - '_sentryCaptured', - '_sentryId', - // Keeps the frozen DSC on a Sentry Span - '_frozenDsc', - // These are used to keep span & scope relationships - '_sentryRootSpan', - '_sentryChildSpans', - '_sentrySpan', - '_sentryScope', - '_sentryIsolationScope', - // require-in-the-middle calls `Module._resolveFilename`. We cannot mangle this (AWS lambda layer bundle). - '_resolveFilename', - // Set on e.g. the shim feedbackIntegration to be able to detect it - '_isShim', - // Marker used to detect `beforeSendSpan` callbacks expecting the static span format - '_static', - // This is used in metadata integration - '_sentryModuleMetadata', - ], - }, - }, - format: { - comments: false, - }, - }); +export function makeMinifierOptions() { + // mangle: { + // // `captureException` and `captureMessage` are public API methods and they don't need to be listed here, as the + // // mangler won't touch user-facing things, but `sentryWrapped` is not user-facing, and would be mangled during + // // minification. (We need it in its original form to correctly detect our internal frames for stripping.) All three + // // are all listed here just for the clarity's sake, as they are all used in the frames manipulation process. + // reserved: ['captureException', 'captureMessage', 'sentryWrapped'], + // properties: { + // // allow mangling of private field names... + // regex: /^_[^_]/, + // reserved: [ + // // ...except for `_experiments`, which we want to remain usable from the outside + // '_experiments', + // // We want to keep some replay fields unmangled to enable integration tests to access them + // '_replay', + // '_canvas', + // // We also can't mangle rrweb private fields when bundling rrweb in the replay CDN bundles + // '_cssText', + // // We want to keep the _integrations variable unmangled to send all installed integrations from replay + // '_integrations', + // // _meta is used to store metadata of replay network events + // '_meta', + // // We store SDK metadata in the options + // '_metadata', + // // Object we inject debug IDs into with bundler plugins + // '_sentryDebugIds', + // // These are used by instrument.ts in utils for identifying HTML elements & events + // '_sentryCaptured', + // '_sentryId', + // // Keeps the frozen DSC on a Sentry Span + // '_frozenDsc', + // // These are used to keep span & scope relationships + // '_sentryRootSpan', + // '_sentryChildSpans', + // '_sentrySpan', + // '_sentryScope', + // '_sentryIsolationScope', + // // require-in-the-middle calls `Module._resolveFilename`. We cannot mangle this (AWS lambda layer bundle). + // '_resolveFilename', + // // Set on e.g. the shim feedbackIntegration to be able to detect it + // '_isShim', + // // Marker used to detect `beforeSendSpan` callbacks expecting the static span format + // '_static', + // // This is used in metadata integration + // '_sentryModuleMetadata', + // ], + // }, + // }, + return true; } - -// We don't pass these plugins any options which need to be calculated or changed by us, so no need to wrap them in -// another factory function, as they are themselves already factory functions. - -export function makeNodeResolvePlugin() { - return nodeResolve(); -} - -export { commonjs as makeCommonJSPlugin }; diff --git a/dev-packages/rollup-utils/plugins/make-esm-plugin.mjs b/dev-packages/rollup-utils/plugins/make-esm-plugin.mjs index ad18856c011a..908afc7cb157 100644 --- a/dev-packages/rollup-utils/plugins/make-esm-plugin.mjs +++ b/dev-packages/rollup-utils/plugins/make-esm-plugin.mjs @@ -1,4 +1,5 @@ import fs from 'node:fs'; +import path from 'node:path'; /** * Outputs a package.json file with {type: module} in the root of the output directory so that Node @@ -11,9 +12,9 @@ export function makePackageNodeEsm() { // We need to keep the `sideEffects` value from the original package.json, // as e.g. webpack seems to depend on this // without this, tree shaking does not work as expected - const packageJSONPath = (await this.resolve('package.json')).id; - - const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8')); + const packageJSON = JSON.parse( + fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }), + ); const sideEffects = packageJSON.sideEffects; // For module federation we need to keep the version of the package const version = packageJSON.version; diff --git a/dev-packages/rollup-utils/plugins/npmPlugins.mjs b/dev-packages/rollup-utils/plugins/npmPlugins.mjs index f17d102e012c..b3ae0f3be767 100644 --- a/dev-packages/rollup-utils/plugins/npmPlugins.mjs +++ b/dev-packages/rollup-utils/plugins/npmPlugins.mjs @@ -1,56 +1,8 @@ /** - * Rollup plugin hooks docs: https://rollupjs.org/guide/en/#build-hooks and - * https://rollupjs.org/guide/en/#output-generation-hooks - * - * esbuild plugin docs: https://github.com/egoist/rollup-plugin-esbuild - * Replace plugin docs: https://github.com/rollup/plugins/tree/master/packages/replace - */ - -import json from '@rollup/plugin-json'; -import replace from '@rollup/plugin-replace'; -import esbuild from 'rollup-plugin-esbuild'; - -/** - * Create a plugin to transpile TS/JSX syntax using `esbuild`. - * - * `target: 'es2020'` keeps ES2020-native syntax (`?.`, `??`, optional catch binding) and - * downlevels everything newer (logical assignment, numeric separators, class private - * fields, static class blocks, ...). - * - * `esbuildOptions` are forwarded to `rollup-plugin-esbuild` verbatim and can override - * any of the pinned defaults (e.g. JSX-related keys like `jsxFactory` / `jsxFragment` - * for packages that use a non-React pragma). + * Replace plugin docs: https://rolldown.rs/builtin-plugins/replace#replace-plugin */ -export function makeEsbuildPlugin(esbuildOptions = {}) { - const plugin = esbuild({ - // `.json` is handled by the JSON plugin further down the pipeline. - exclude: ['**/*.json'], - // ES2020 is our floor — keeps `?.`/`??` native, downlevels everything newer. - target: 'es2020', - // Don't read per-package tsconfig (they vary and can pull in unrelated settings). - // Pin only the compilerOptions that affect codegen. - tsconfig: false, - tsconfigRaw: { - compilerOptions: { - // Match the project tsconfig's effective behavior at target=es2020: class - // field initializers compile to `this.x = v` (set semantics), not via the - // `Object.defineProperty`-based `__publicField` helper esbuild emits by - // default. This is what tsc itself outputs at this target. - useDefineForClassFields: false, - }, - }, - sourceMap: true, - ...esbuildOptions, - }); - // Force a stable plugin name so the plugin sort order in utils.mjs can target it. - plugin.name = 'esbuild'; - return plugin; -} - -export function makeJsonPlugin() { - return json(); -} +import { replacePlugin } from 'rolldown/plugins'; /** * Create a plugin which can be used to pause the build process at the given hook. @@ -107,24 +59,23 @@ export function makeDebuggerPlugin(hookName) { * a) evaluates to `true` * b) can easily be modified by our users' bundlers to evaluate to false, facilitating the treeshaking of logger code. * - * @returns A `@rollup/plugin-replace` instance. + * @returns A `rolldown` replace plugin instance. */ export function makeDebugBuildStatementReplacePlugin() { - const plugin = replace({ - preventAssignment: false, - values: { + return replacePlugin( + { __DEBUG_BUILD__: "(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)", }, - }); - plugin.name = 'replace-debug-build-statement'; - return plugin; + { + preventAssignment: true, + }, + ); } -// Markers use the `/*! ... */` legal-comment syntax so esbuild preserves them through -// transpile. We still run as a `transform` (per-module) hook rather than `renderChunk`: -// the block typically uses imports declared at the module top, and stripping it before -// rollup analyses module-graph imports lets those now-unused imports be tree-shaken away. -// The plugin sort order in utils.mjs pins this before `esbuild`. +// Markers use the `/*! ... */` legal-comment syntax so rolldown's transpile preserves them. +// We run as a `transform` (per-module) hook rather than `renderChunk`: the block typically uses +// imports declared at the module top, and stripping it before the module graph is analysed lets +// those now-unused imports be tree-shaken away. const REMOVE_DEV_BLOCK = /\/\*! rollup-include-development-only \*\/[\s\S]*?\/\*! rollup-include-development-only-end \*\/\s*/g; @@ -175,10 +126,7 @@ export function makeRrwebBuildPlugin({ excludeShadowDom, excludeIframe } = {}) { values['__RRWEB_EXCLUDE_IFRAME__'] = excludeIframe; } - const plugin = replace({ + return replacePlugin(values, { preventAssignment: true, - values, }); - plugin.name = 'replace-rrweb-build-flags'; - return plugin; } diff --git a/dev-packages/rollup-utils/utils.mjs b/dev-packages/rollup-utils/utils.mjs index 503a4876d223..8b0e00199e9c 100644 --- a/dev-packages/rollup-utils/utils.mjs +++ b/dev-packages/rollup-utils/utils.mjs @@ -1,3 +1,5 @@ +import { builtinModules } from 'module'; + /** * Helper function to compensate for the fact that JS can't handle negative array indices very well */ @@ -33,34 +35,21 @@ export function mergeExternals(base, specific) { * Merge two arrays of plugins, making sure they're sorted in the correct order. * * Each entry in `order` is pinned for a real reason; `...` is where every other plugin lands. + * + * Rolldown's builtin plugins all report the same `name` (e.g. `builtin:replace`), so they can't be + * pinned individually and all land in `...`, where `Array.prototype.sort` keeps them in insertion + * order. That's fine: the transpile step they used to be ordered against is now part of rolldown + * itself and always runs first. */ export function mergePlugins(pluginsA, pluginsB) { const order = [ - // (transform) Strips `/*! rollup-include-development-only */` marker blocks. Must precede `esbuild` so the - // now-unused imports inside the block can be tree-shaken by rollup. + // (transform) Strips `/*! rollup-include-development-only */` marker blocks. Runs first so the + // now-unused imports inside the block can be tree-shaken. 'remove-dev-mode-blocks', - // (transform) Rewrites the `/*! __SENTRY_SDK_SOURCE__ */` comment marker in `getSDKSource()` for CDN builds. - // Comment-based → must precede `esbuild` (the marker uses `/*!` legal-comment syntax, but pinning is defensive). - 'replace-sdk-source', - // (transform) TS/JSX → JS, strips non-legal block comments, strips `declare const` lines. - 'esbuild', - // The identifier-based `replace-*` plugins below MUST run AFTER `esbuild`. Each of these identifiers is also - // declared in TS via `declare const __FOO__: ...;` lines. If the replace runs before esbuild, it rewrites the - // declaration's identifier into an expression and produces invalid TS. esbuild strips `declare const` lines, - // so by the time these plugins run the only remaining occurrences are real references. - 'replace-debug-build-statement', - 'replace-browser-bundle-flag', - 'replace-debug-flags', - 'replace-rrweb-build-flags', - // Every other plugin lands here — including additional identifier-based `replace-*` plugins (e.g. - // `replace-sdk-version`), which intentionally run AFTER `esbuild` for the same reason as the ones pinned above. + // (transform) Strips the marker blocks for the format we're not currently emitting. + 'remove-esm-cjs-mode-blocks', + // Every other plugin lands here, including the identifier-based `builtin:replace` instances. '...', - // (renderChunk) Minifies and strips comments (we use `comments: false`). Anything that contributes code to a - // chunk must run before this. - 'terser', - // (renderChunk) Prepends the license banner, which is a comment. Must run AFTER `terser`, otherwise terser - // would strip it. - 'license', // (renderChunk) Captures the final chunk text as base64, so it must run last. 'output-base64-worker-script', ]; @@ -72,3 +61,33 @@ export function mergePlugins(pluginsA, pluginsB) { }); return plugins; } + +/** + * Rolldown has no `'smallest'` treeshake preset, so spell out what rollup's `'smallest'` meant. + * + * https://rolldown.rs/options/treeshake#treeshake + * https://rollupjs.org/configuration-options/#treeshake + */ +export function treeShakePreset(preset) { + if (preset === 'smallest') { + return { + propertyReadSideEffects: false, + moduleSideEffects: false, + unknownGlobalSideEffects: false, + }; + } + + return preset; +} + +/** + * List every Node.js builtin under both its bare name (`fs`) and its prefixed name (`node:fs`). + * + * Rollup normalised the `node:` prefix for us when matching externals; rolldown doesn't, so both + * spellings have to be listed explicitly. + */ +export function getNodeBuiltIns(excludeBuiltins = []) { + const excluded = new Set(excludeBuiltins); + + return builtinModules.flatMap(builtin => (excluded.has(builtin) ? [] : [builtin, `node:${builtin}`])); +} diff --git a/dev-packages/test-utils/package.json b/dev-packages/test-utils/package.json index 47ea0798b349..aaf082bb6c03 100644 --- a/dev-packages/test-utils/package.json +++ b/dev-packages/test-utils/package.json @@ -35,7 +35,7 @@ "build": "run-s build:transpile build:types", "build:tarball": "run-s build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "clean": "rimraf -g ./node_modules ./build" }, diff --git a/package.json b/package.json index 4c88d266077b..90796ec9cee1 100644 --- a/package.json +++ b/package.json @@ -113,11 +113,6 @@ "dev-packages/bundler-tests" ], "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.7", - "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^16.0.3", - "@rollup/plugin-replace": "^5.0.5", - "@rollup/plugin-terser": "^0.4.4", "@size-limit/esbuild": "~12.1.0", "@size-limit/file": "~12.1.0", "@size-limit/webpack": "~12.1.0", @@ -126,7 +121,6 @@ "@vitest/coverage-v8": "^3.2.7", "deepmerge": "^4.2.2", "es-check": "^7.2.1", - "esbuild": "^0.28.1", "jsdom": "^21.1.2", "madge": "8.0.0", "nodemon": "^3.1.10", @@ -136,8 +130,8 @@ "oxlint": "^1.75.0", "oxlint-tsgolint": "7", "rimraf": "^5.0.10", + "rolldown": "^1.2.5", "rollup": "^4.60.3", - "rollup-plugin-esbuild": "^6.2.1", "rollup-plugin-license": "^3.7.1", "size-limit": "~12.1.0", "tsx": "^4.23.0", diff --git a/packages/astro/package.json b/packages/astro/package.json index fc8963842b31..0d6601fbafcf 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -65,11 +65,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", "clean": "rimraf build coverage sentry-astro-*.tgz", diff --git a/packages/aws-serverless/package.json b/packages/aws-serverless/package.json index f9aee38fe079..63ede59ee68d 100644 --- a/packages/aws-serverless/package.json +++ b/packages/aws-serverless/package.json @@ -68,15 +68,16 @@ }, "scripts": { "build": "run-p build:transpile build:types", - "build:extension": "rollup -c rollup.lambda-extension.config.mjs && yarn tsx scripts/buildLambdaExtension.ts", + "build:extension": "rolldown -c rollup.lambda-extension.config.mjs && yarn tsx scripts/buildLambdaExtension.ts", "build:layer": "rimraf build/aws && yarn tsx scripts/buildLambdaLayer.ts", "build:dev": "run-p build:transpile build:types", - "build:transpile": "run-s build:transpile:npm build:extension", - "build:transpile:npm": "rollup -c rollup.npm.config.mjs", + "build:transpile": "run-s build:transpile:npm build:extension build:layer", + "build:transpile:npm": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build dist-awslambda-layer coverage sentry-serverless-*.tgz", diff --git a/packages/aws-serverless/rollup.npm.config.mjs b/packages/aws-serverless/rollup.npm.config.mjs index ff398be22729..f0d008b22f6f 100644 --- a/packages/aws-serverless/rollup.npm.config.mjs +++ b/packages/aws-serverless/rollup.npm.config.mjs @@ -9,7 +9,7 @@ function makeHandlerShimConfig() { const baseConfig = makeBaseNPMConfig({ entrypoints: ['src/run-lambda-handler.ts'], // Top-level await requires es2022. - esbuild: { target: 'es2022' }, + packageSpecificConfig: { transform: { target: 'es2022' } }, }); return { diff --git a/packages/browser-utils/package.json b/packages/browser-utils/package.json index 6f11ac7f7272..93a9b671ab0b 100644 --- a/packages/browser-utils/package.json +++ b/packages/browser-utils/package.json @@ -40,11 +40,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", - "build:watch": "run-p build:transpile:watch", - "build:dev:watch": "run-p build:transpile:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:watch": "run-p build:transpile:watch build:types:watch", + "build:dev:watch": "run-p build:transpile:watch build:types:watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "clean": "rimraf build coverage sentry-browser-utils-*.tgz", "lint:fix": "oxlint . --fix --type-aware", diff --git a/packages/browser-utils/test/performance/elementTiming.test.ts b/packages/browser-utils/test/performance/elementTiming.test.ts index 26ca3c8ee178..a44cccf00c6c 100644 --- a/packages/browser-utils/test/performance/elementTiming.test.ts +++ b/packages/browser-utils/test/performance/elementTiming.test.ts @@ -1,12 +1,17 @@ -import * as sentryCore from '@sentry/core'; +import type * as sentryCore from '@sentry/core'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { elementTimingIntegration, startTrackingElementTiming } from '../../src/performance/elementTiming'; import * as browserMetricsInstrumentation from '../../src/instrumentation/performanceObserver'; import * as browserMetricsUtils from '../../src/performance/utils'; -describe('elementTimingIntegration', () => { - const distributionSpy = vi.spyOn(sentryCore.metrics, 'distribution'); +const { distributionSpy } = vi.hoisted(() => ({ distributionSpy: vi.fn() })); + +vi.mock('@sentry/core', async () => { + const actual = await vi.importActual('@sentry/core'); + return { ...actual, metrics: { ...actual.metrics, distribution: distributionSpy } }; +}); +describe('elementTimingIntegration', () => { let elementHandler: (data: { entries: PerformanceEntry[] }) => void; beforeEach(() => { diff --git a/packages/browser/package.json b/packages/browser/package.json index cb2d78fa542d..59a24281ca0d 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -52,13 +52,14 @@ "scripts": { "build": "run-p build:transpile build:bundle build:types", "build:dev": "run-p build:transpile build:types", - "build:bundle": "rollup -c rollup.bundle.config.mjs", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:bundle": "rolldown -c rollup.bundle.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", - "build:watch": "run-p build:transpile:watch build:bundle:watch", - "build:dev:watch": "run-p build:transpile:watch", - "build:bundle:watch": "rollup -c rollup.bundle.config.mjs --watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:watch": "run-p build:transpile:watch build:bundle:watch build:types:watch", + "build:dev:watch": "run-p build:transpile:watch build:types:watch", + "build:bundle:watch": "rolldown -c rollup.bundle.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage .rpt2_cache sentry-browser-*.tgz", diff --git a/packages/bun/package.json b/packages/bun/package.json index 93fe66ff346c..9daa734def8d 100644 --- a/packages/bun/package.json +++ b/packages/bun/package.json @@ -54,11 +54,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-bun-*.tgz", diff --git a/packages/bun/test/integrations/bunRuntimeMetrics.test.ts b/packages/bun/test/integrations/bunRuntimeMetrics.test.ts index a03b07ffe760..8b5ce6b5d00b 100644 --- a/packages/bun/test/integrations/bunRuntimeMetrics.test.ts +++ b/packages/bun/test/integrations/bunRuntimeMetrics.test.ts @@ -1,5 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, jest, mock, spyOn } from 'bun:test'; -import { metrics } from '@sentry/core'; + +const mockGauge = jest.fn(); +const mockCount = jest.fn(); const mockElu = { idle: 700, active: 300, utilization: 0.3 }; const mockEluDelta = { idle: 700, active: 300, utilization: 0.3 }; @@ -12,16 +14,19 @@ mock.module('perf_hooks', () => ({ performance: { eventLoopUtilization: mockEventLoopUtilization }, })); +const actualCore = await import('@sentry/core'); +mock.module('@sentry/core', () => ({ + ...actualCore, + metrics: { ...actualCore.metrics, gauge: mockGauge, count: mockCount }, +})); + const { bunRuntimeMetricsIntegration } = await import('../../src/integrations/bunRuntimeMetrics'); describe('bunRuntimeMetricsIntegration', () => { - let gaugeSpy: ReturnType; - let countSpy: ReturnType; - beforeEach(() => { jest.useFakeTimers(); - gaugeSpy = spyOn(metrics, 'gauge').mockImplementation(() => undefined); - countSpy = spyOn(metrics, 'count').mockImplementation(() => undefined); + mockGauge.mockClear(); + mockCount.mockClear(); spyOn(process, 'cpuUsage').mockReturnValue({ user: 500_000, system: 200_000 }); spyOn(process, 'memoryUsage').mockReturnValue({ @@ -50,9 +55,9 @@ describe('bunRuntimeMetricsIntegration', () => { const integration = bunRuntimeMetricsIntegration({ collectionIntervalMs: 1_000 }); integration.setup(); - expect(gaugeSpy).not.toHaveBeenCalled(); + expect(mockGauge).not.toHaveBeenCalled(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalled(); + expect(mockGauge).toHaveBeenCalled(); }); it('does not throw if performance.eventLoopUtilization is unavailable', () => { @@ -75,7 +80,7 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('bun.runtime.cpu.utilization', expect.any(Number), ORIGIN); + expect(mockGauge).toHaveBeenCalledWith('bun.runtime.cpu.utilization', expect.any(Number), ORIGIN); }); it('does not emit cpu.user / cpu.system by default (opt-in)', () => { @@ -83,8 +88,8 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith('bun.runtime.cpu.user', expect.anything(), expect.anything()); - expect(gaugeSpy).not.toHaveBeenCalledWith('bun.runtime.cpu.system', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('bun.runtime.cpu.user', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('bun.runtime.cpu.system', expect.anything(), expect.anything()); }); it('emits cpu.user / cpu.system when cpuTime is opted in', () => { @@ -95,8 +100,8 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('bun.runtime.cpu.user', expect.any(Number), SECOND); - expect(gaugeSpy).toHaveBeenCalledWith('bun.runtime.cpu.system', expect.any(Number), SECOND); + expect(mockGauge).toHaveBeenCalledWith('bun.runtime.cpu.user', expect.any(Number), SECOND); + expect(mockGauge).toHaveBeenCalledWith('bun.runtime.cpu.system', expect.any(Number), SECOND); }); it('emits mem.rss, mem.heap_used, mem.heap_total (default on)', () => { @@ -104,9 +109,9 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('bun.runtime.mem.rss', 50_000_000, BYTE); - expect(gaugeSpy).toHaveBeenCalledWith('bun.runtime.mem.heap_used', 20_000_000, BYTE); - expect(gaugeSpy).toHaveBeenCalledWith('bun.runtime.mem.heap_total', 30_000_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('bun.runtime.mem.rss', 50_000_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('bun.runtime.mem.heap_used', 20_000_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('bun.runtime.mem.heap_total', 30_000_000, BYTE); }); it('does not emit mem.external / mem.array_buffers by default (opt-in)', () => { @@ -114,8 +119,8 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith('bun.runtime.mem.external', expect.anything(), expect.anything()); - expect(gaugeSpy).not.toHaveBeenCalledWith('bun.runtime.mem.array_buffers', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('bun.runtime.mem.external', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('bun.runtime.mem.array_buffers', expect.anything(), expect.anything()); }); it('emits mem.external / mem.array_buffers when opted in', () => { @@ -126,8 +131,8 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('bun.runtime.mem.external', 1_000_000, BYTE); - expect(gaugeSpy).toHaveBeenCalledWith('bun.runtime.mem.array_buffers', 500_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('bun.runtime.mem.external', 1_000_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('bun.runtime.mem.array_buffers', 500_000, BYTE); }); it('emits event loop utilization metric', () => { @@ -135,7 +140,7 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('bun.runtime.event_loop.utilization', 0.3, ORIGIN); + expect(mockGauge).toHaveBeenCalledWith('bun.runtime.event_loop.utilization', 0.3, ORIGIN); }); it('does not emit event loop utilization if performance.eventLoopUtilization threw during setup', () => { @@ -147,7 +152,7 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith( + expect(mockGauge).not.toHaveBeenCalledWith( 'bun.runtime.event_loop.utilization', expect.anything(), expect.anything(), @@ -159,7 +164,7 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(countSpy).toHaveBeenCalledWith('bun.runtime.process.uptime', expect.any(Number), SECOND); + expect(mockCount).toHaveBeenCalledWith('bun.runtime.process.uptime', expect.any(Number), SECOND); }); }); @@ -172,7 +177,7 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith('bun.runtime.cpu.utilization', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('bun.runtime.cpu.utilization', expect.anything(), expect.anything()); }); it('skips mem.rss when memRss is false', () => { @@ -183,7 +188,7 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith('bun.runtime.mem.rss', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('bun.runtime.mem.rss', expect.anything(), expect.anything()); }); it('skips event loop utilization when eventLoopUtilization is false', () => { @@ -194,7 +199,7 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith( + expect(mockGauge).not.toHaveBeenCalledWith( 'bun.runtime.event_loop.utilization', expect.anything(), expect.anything(), @@ -209,7 +214,7 @@ describe('bunRuntimeMetricsIntegration', () => { integration.setup(); jest.advanceTimersByTime(1_000); - expect(countSpy).not.toHaveBeenCalledWith('bun.runtime.process.uptime', expect.anything(), expect.anything()); + expect(mockCount).not.toHaveBeenCalledWith('bun.runtime.process.uptime', expect.anything(), expect.anything()); }); }); @@ -225,10 +230,10 @@ describe('bunRuntimeMetricsIntegration', () => { // Should fire at minimum 1000ms, not at 100ms jest.advanceTimersByTime(100); - expect(gaugeSpy).not.toHaveBeenCalled(); + expect(mockGauge).not.toHaveBeenCalled(); jest.advanceTimersByTime(900); - expect(gaugeSpy).toHaveBeenCalled(); + expect(mockGauge).toHaveBeenCalled(); }); it('falls back to default when NaN', () => { @@ -241,10 +246,10 @@ describe('bunRuntimeMetricsIntegration', () => { // Should fire at the default 30000ms, not at 1000ms jest.advanceTimersByTime(1000); - expect(gaugeSpy).not.toHaveBeenCalled(); + expect(mockGauge).not.toHaveBeenCalled(); jest.advanceTimersByTime(29_000); - expect(gaugeSpy).toHaveBeenCalled(); + expect(mockGauge).toHaveBeenCalled(); }); }); }); diff --git a/packages/bundler-plugins/package.json b/packages/bundler-plugins/package.json index d66abc03c9f7..d0695cd3500f 100644 --- a/packages/bundler-plugins/package.json +++ b/packages/bundler-plugins/package.json @@ -70,11 +70,11 @@ "build": "run-p build:transpile build:types", "build:dev": "yarn build", "build:version": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/core/version.ts", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", "build:tarball": "npm pack", "prebuild": "yarn build:version", "precheck:types": "yarn build:version", diff --git a/packages/bundler-plugins/rollup.npm.config.mjs b/packages/bundler-plugins/rollup.npm.config.mjs index bd0f18d8a23d..5f465be26ad7 100644 --- a/packages/bundler-plugins/rollup.npm.config.mjs +++ b/packages/bundler-plugins/rollup.npm.config.mjs @@ -13,16 +13,16 @@ export default makeNPMConfigVariants( 'src/babel-plugin/index.ts', ], packageSpecificConfig: { + // This package only ever runs in Node, at build time. Without pinning the platform, rolldown + // would infer 'browser' for the ESM half, which defines `process.env.NODE_ENV` as + // 'development' (silently disabling release creation and sourcemap upload) and drops the + // `import.meta.url` rewrite the `createRequire` calls in `./webpack` depend on. + platform: 'node', output: { // Multiple entry points with no single default export -> emit named exports - // so rollup doesn't warn. `preserveModules` (true by default in the base config) + // so the bundler doesn't warn. `preserveModules` (true by default in the base config) // keeps the per-submodule file layout the `exports` map points at. exports: 'named', - // The source default-imports CJS Node builtins (e.g. `import crypto from 'crypto'`). - // The shared base config's `interop: 'esModule'` would emit `require('crypto').default` - // in the CJS build (undefined for real CJS modules -> runtime crash). `auto` emits the - // interop helper so default-imported CJS builtins resolve correctly. - interop: 'auto', }, }, }), diff --git a/packages/cloudflare/package.json b/packages/cloudflare/package.json index 09b9604be99b..83768e553ca3 100644 --- a/packages/cloudflare/package.json +++ b/packages/cloudflare/package.json @@ -73,11 +73,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-cloudflare-*.tgz", diff --git a/packages/core/package.json b/packages/core/package.json index fd7a5fefd008..23591db28afa 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -70,11 +70,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-core-*.tgz", diff --git a/packages/core/rollup.npm.config.mjs b/packages/core/rollup.npm.config.mjs index 47d28e630457..1b079d3deb74 100644 --- a/packages/core/rollup.npm.config.mjs +++ b/packages/core/rollup.npm.config.mjs @@ -2,8 +2,8 @@ import { readFileSync } from 'fs'; import { dirname, join } from 'path'; +import { replacePlugin } from 'rolldown/plugins'; import { fileURLToPath } from 'url'; -import replace from '@rollup/plugin-replace'; import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; const packageJson = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'package.json'), 'utf-8')); @@ -23,12 +23,14 @@ const settings = { preserveModules: true, }, plugins: [ - replace({ - preventAssignment: true, - values: { + replacePlugin( + { __SENTRY_SDK_VERSION__: JSON.stringify(packageVersion), }, - }), + { + preventAssignment: true, + }, + ), ], }, }; diff --git a/packages/deno/package.json b/packages/deno/package.json index 30a68d5e2a68..b6692a658ee1 100644 --- a/packages/deno/package.json +++ b/packages/deno/package.json @@ -36,7 +36,7 @@ "deno-types": "node ./scripts/download-deno-types.mjs", "build": "run-s build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "yarn deno-types && rollup -c rollup.npm.config.mjs", + "build:transpile": "yarn deno-types && rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/deno/rollup.npm.config.mjs b/packages/deno/rollup.npm.config.mjs index 08ffaddf0bbe..ddfaf47224a3 100644 --- a/packages/deno/rollup.npm.config.mjs +++ b/packages/deno/rollup.npm.config.mjs @@ -1,4 +1,4 @@ -import { defineConfig } from 'rollup'; +import { defineConfig } from 'rolldown'; import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; const orchestrionRuntimeHooks = [ diff --git a/packages/effect/package.json b/packages/effect/package.json index e89e70e44110..6054dd200fcb 100644 --- a/packages/effect/package.json +++ b/packages/effect/package.json @@ -64,11 +64,11 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", "clean": "rimraf build coverage sentry-effect-*.tgz", diff --git a/packages/effect/test/metrics.test.ts b/packages/effect/test/metrics.test.ts index a8d5a9813fa9..54c5ecf9dd5a 100644 --- a/packages/effect/test/metrics.test.ts +++ b/packages/effect/test/metrics.test.ts @@ -1,25 +1,33 @@ import { describe, expect, it } from '@effect/vitest'; -import * as sentryCore from '@sentry/core'; import * as Context from 'effect/Context'; import { Duration, Effect, Layer, Metric } from 'effect'; import { TestClock } from 'effect/testing'; import { afterEach, beforeEach, vi } from 'vitest'; import { SentryEffectMetricsLayer } from '../src/metrics'; -describe('SentryEffectMetricsLayer', () => { - const mockCount = vi.fn(); - const mockGauge = vi.fn(); - const mockDistribution = vi.fn(); +const { mockCount, mockGauge, mockDistribution } = vi.hoisted(() => ({ + mockCount: vi.fn(), + mockGauge: vi.fn(), + mockDistribution: vi.fn(), +})); + +vi.mock('@sentry/core', async () => { + const actual = await vi.importActual('@sentry/core'); + return { + ...actual, + metrics: { ...actual.metrics, count: mockCount, gauge: mockGauge, distribution: mockDistribution }, + }; +}); +describe('SentryEffectMetricsLayer', () => { beforeEach(() => { - vi.spyOn(sentryCore.metrics, 'count').mockImplementation(mockCount); - vi.spyOn(sentryCore.metrics, 'gauge').mockImplementation(mockGauge); - vi.spyOn(sentryCore.metrics, 'distribution').mockImplementation(mockDistribution); + mockCount.mockClear(); + mockGauge.mockClear(); + mockDistribution.mockClear(); }); afterEach(() => { vi.clearAllMocks(); - vi.restoreAllMocks(); }); it.effect('creates counter metrics', () => @@ -146,19 +154,14 @@ describe('SentryEffectMetricsLayer', () => { }); describe('SentryEffectMetricsLayer flushing', () => { - const mockCount = vi.fn(); - const mockGauge = vi.fn(); - const mockDistribution = vi.fn(); - beforeEach(() => { - vi.spyOn(sentryCore.metrics, 'count').mockImplementation(mockCount); - vi.spyOn(sentryCore.metrics, 'gauge').mockImplementation(mockGauge); - vi.spyOn(sentryCore.metrics, 'distribution').mockImplementation(mockDistribution); + mockCount.mockClear(); + mockGauge.mockClear(); + mockDistribution.mockClear(); }); afterEach(() => { vi.clearAllMocks(); - vi.restoreAllMocks(); }); const TestLayer = SentryEffectMetricsLayer.pipe(Layer.provideMerge(TestClock.layer())); diff --git a/packages/elysia/package.json b/packages/elysia/package.json index e4aa54999090..e1f3a90a413b 100644 --- a/packages/elysia/package.json +++ b/packages/elysia/package.json @@ -51,11 +51,11 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-elysia-*.tgz", diff --git a/packages/eslint-config-sdk/src/base.js b/packages/eslint-config-sdk/src/base.js index b67c2ec3a76d..7dbeb0b90b74 100644 --- a/packages/eslint-config-sdk/src/base.js +++ b/packages/eslint-config-sdk/src/base.js @@ -236,6 +236,8 @@ module.exports = { balanced: true, // ... unless they're jsdoc-style block comments, which end with `**/` exceptions: ['*'], + // Allow /*! for legal/preserved comments + markers: ['!'], }, }, ], diff --git a/packages/feedback/package.json b/packages/feedback/package.json index 37dac84d99a5..b06d8c4f24cb 100644 --- a/packages/feedback/package.json +++ b/packages/feedback/package.json @@ -40,8 +40,8 @@ }, "scripts": { "build": "run-p build:transpile build:types build:bundle", - "build:transpile": "rollup -c rollup.npm.config.mjs", - "build:bundle": "rollup -c rollup.bundle.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", + "build:bundle": "rolldown -c rollup.bundle.config.mjs", "build:dev": "run-p build:transpile build:types", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch build:bundle:watch", diff --git a/packages/feedback/rollup.bundle.config.mjs b/packages/feedback/rollup.bundle.config.mjs index b3f54dfb2b85..894d5eca6205 100644 --- a/packages/feedback/rollup.bundle.config.mjs +++ b/packages/feedback/rollup.bundle.config.mjs @@ -1,5 +1,15 @@ import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal/rollup-utils'; +// Alias react to preact/compat since this package uses Preact for rendering +const preactAlias = { + resolve: { + alias: { + react: 'preact/compat', + 'react/jsx-runtime': 'preact/jsx-runtime', + }, + }, +}; + export default [ // The core `feedback` bundle is built in the browser package // Sub-bundles are built here @@ -10,11 +20,7 @@ export default [ jsVersion: 'es6', licenseTitle: '@sentry/feedback', outputFileBase: () => 'bundles/feedback-screenshot', - esbuild: { - // The feedback widget uses preact, so override esbuild's React defaults. - jsxFactory: 'h', - jsxFragment: 'Fragment', - }, + packageSpecificConfig: preactAlias, }), ), ...makeBundleConfigVariants( @@ -24,11 +30,7 @@ export default [ jsVersion: 'es6', licenseTitle: '@sentry/feedback', outputFileBase: () => 'bundles/feedback-modal', - esbuild: { - // The feedback widget uses preact, so override esbuild's React defaults. - jsxFactory: 'h', - jsxFragment: 'Fragment', - }, + packageSpecificConfig: preactAlias, }), ), ]; diff --git a/packages/feedback/rollup.npm.config.mjs b/packages/feedback/rollup.npm.config.mjs index 03e8c739c9d6..5a1800f23b08 100644 --- a/packages/feedback/rollup.npm.config.mjs +++ b/packages/feedback/rollup.npm.config.mjs @@ -12,10 +12,5 @@ export default makeNPMConfigVariants( preserveModules: false, }, }, - esbuild: { - // The feedback widget uses preact, so override esbuild's React defaults. - jsxFactory: 'h', - jsxFragment: 'Fragment', - }, }), ); diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index af1480d61ba1..297b2c85fd8b 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -57,11 +57,12 @@ "build:dev": "yarn build", "build:plugin": "tsc -p tsconfig.plugin.json", "build:transpile": "run-p build:rollup build:plugin", - "build:rollup": "rollup -c rollup.npm.config.mjs", + "build:rollup": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage *.d.ts sentry-gatsby-*.tgz", diff --git a/packages/google-cloud-serverless/package.json b/packages/google-cloud-serverless/package.json index 294975ad518e..d23956eadfda 100644 --- a/packages/google-cloud-serverless/package.json +++ b/packages/google-cloud-serverless/package.json @@ -59,11 +59,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-google-cloud-*.tgz", diff --git a/packages/hono/package.json b/packages/hono/package.json index bcf44401dce6..0a7483a6391d 100644 --- a/packages/hono/package.json +++ b/packages/hono/package.json @@ -114,11 +114,11 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-hono-*.tgz", diff --git a/packages/integration-shims/package.json b/packages/integration-shims/package.json index 70202b509381..3fe93000057a 100644 --- a/packages/integration-shims/package.json +++ b/packages/integration-shims/package.json @@ -25,7 +25,7 @@ "private": true, "scripts": { "build": "run-p build:transpile build:types", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:dev": "yarn build", "build:watch": "run-p build:transpile:watch", diff --git a/packages/nestjs/package.json b/packages/nestjs/package.json index d25f7b4def37..895e5ac80194 100644 --- a/packages/nestjs/package.json +++ b/packages/nestjs/package.json @@ -62,13 +62,14 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "run-s build:types:core build:types:setup", "build:types:core": "tsc -p tsconfig.types.json", "build:types:setup": "tsc -p tsconfig.setup-types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts && madge --circular src/setup.ts", "clean": "rimraf build coverage sentry-nestjs-*.tgz ./*.d.ts ./*.d.ts.map", diff --git a/packages/nextjs/rollup.npm.config.mjs b/packages/nextjs/rollup.npm.config.mjs index f6f94a3d9883..8d3d325cde7a 100644 --- a/packages/nextjs/rollup.npm.config.mjs +++ b/packages/nextjs/rollup.npm.config.mjs @@ -19,6 +19,10 @@ export default [ packageSpecificConfig: { external: ['next/router', 'next/constants', 'next/headers', 'stacktrace-parser'], + output: { + virtualDirname: '_virtual/core', + }, + // Next.js and our users are more happy when our client code has the "use client" directive plugins: [ { @@ -51,8 +55,7 @@ export default [ packageSpecificConfig: { output: { - // Preserve the original file structure (i.e., so that everything is still relative to `src`) - entryFileNames: 'config/templates/[name].js', + virtualDirname: '_virtual/templates', // this is going to be add-on code, so it doesn't need the trappings of a full module (and in fact actively // shouldn't have them, lest they muck with the module to which we're adding it) @@ -69,6 +72,33 @@ export default [ '__SENTRY_WRAPPING_TARGET_FILE__', '__SENTRY_NEXTJS_REQUEST_ASYNC_STORAGE_SHIM__', ], + plugins: [ + { + name: 'sentry-fix-missing-serverComponentModule-import', + renderChunk(code, chunk) { + // Rolldown has a bug where it removes namespace imports for external modules even when they're still + // referenced in the code (specifically when there's a `declare const` with the same name in the source). + // We need to add back the missing import for serverComponentModule in the serverComponentWrapperTemplate. + if ( + chunk.facadeModuleId?.includes('serverComponentWrapperTemplate') && + code.includes('serverComponentModule') && + !code.includes('import * as serverComponentModule') + ) { + // Find the position after the last import statement to insert our missing import + const lastImportMatch = code.match(/^import[^;]*;/gm); + if (lastImportMatch) { + const lastImport = lastImportMatch[lastImportMatch.length - 1]; + const lastImportEnd = code.indexOf(lastImport) + lastImport.length; + return { + code: `${code.slice(0, lastImportEnd)} +import * as serverComponentModule from "__SENTRY_WRAPPING_TARGET_FILE__";${code.slice(lastImportEnd)}`, + }; + } + } + return null; + }, + }, + ], }, }), ), @@ -78,8 +108,7 @@ export default [ packageSpecificConfig: { output: { - // Preserve the original file structure (i.e., so that everything is still relative to `src`) - entryFileNames: 'config/loaders/[name].js', + virtualDirname: '_virtual/loaders', // make it so Rollup calms down about the fact that we're combining default and named exports exports: 'named', diff --git a/packages/nextjs/scripts/buildRollup.ts b/packages/nextjs/scripts/buildRollup.ts index 69ba523ecb23..a46a65dc2da3 100644 --- a/packages/nextjs/scripts/buildRollup.ts +++ b/packages/nextjs/scripts/buildRollup.ts @@ -10,7 +10,7 @@ function run(cmd: string, options?: childProcess.ExecSyncOptions): string | Buff return childProcess.execSync(cmd, { stdio: 'inherit', ...options }); } -run('yarn rollup -c rollup.npm.config.mjs'); +run('yarn rolldown -c rollup.npm.config.mjs'); // Regardless of whether nextjs is using the CJS or ESM version of our SDK, we want the code from our templates to be in // ESM (since we'll be adding it onto page files which are themselves written in ESM), so copy the ESM versions of the diff --git a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts index 3a05c97d5f5c..2e9d602c9f83 100644 --- a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts @@ -60,8 +60,8 @@ function wrapHandler(handler: T, method: 'GET' | 'POST' | 'PUT' | 'PATCH' | ' // @ts-expect-error See above export * from '__SENTRY_WRAPPING_TARGET_FILE__'; -// @ts-expect-error This is the file we're wrapping -export { default } from '__SENTRY_WRAPPING_TARGET_FILE__'; +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export default routeModule.default; type RouteHandler = (...args: unknown[]) => unknown; diff --git a/packages/nextjs/src/config/templates/sentryInitWrapperTemplate.ts b/packages/nextjs/src/config/templates/sentryInitWrapperTemplate.ts index 3be1b07d6bc5..fd060ebf9df0 100644 --- a/packages/nextjs/src/config/templates/sentryInitWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/sentryInitWrapperTemplate.ts @@ -1,8 +1,9 @@ -// @ts-expect-error This will be replaced with the user's sentry config gile import '__SENTRY_CONFIG_IMPORT_PATH__'; +// @ts-expect-error This is the file we're wrapping +import * as wrappingTargetModule from '__SENTRY_WRAPPING_TARGET_FILE__'; // @ts-expect-error This is the file we're wrapping export * from '__SENTRY_WRAPPING_TARGET_FILE__'; -// @ts-expect-error This is the file we're wrapping -export { default } from '__SENTRY_WRAPPING_TARGET_FILE__'; +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export default wrappingTargetModule.default; diff --git a/packages/nitro/package.json b/packages/nitro/package.json index bd46bd4e50f0..8ce34bcf4cf2 100644 --- a/packages/nitro/package.json +++ b/packages/nitro/package.json @@ -48,12 +48,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "run-s build:types:core", "build:types:core": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch build:types:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "clean": "rimraf build coverage sentry-nitro-*.tgz", diff --git a/packages/node-native/package.json b/packages/node-native/package.json index 4b0795b01331..9526ad271fe6 100644 --- a/packages/node-native/package.json +++ b/packages/node-native/package.json @@ -46,11 +46,12 @@ "lint:es-compatibility": "es-check es2022 ./build/cjs/*.js && es-check es2022 ./build/esm/*.js --module", "lint:fix": "oxlint . --fix --type-aware", "build": "yarn build:types && yarn build:transpile", - "build:transpile": "yarn rollup -c rollup.npm.config.mjs", + "build:transpile": "yarn rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:dev": "yarn clean && yarn build", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", - "build:watch": "run-p build:transpile:watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", + "build:watch": "run-p build:transpile:watch build:types:watch", "build:tarball": "npm pack" }, "dependencies": { diff --git a/packages/node/package.json b/packages/node/package.json index 6202233d0a1f..c1467d1faa99 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -90,11 +90,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-node-*.tgz", diff --git a/packages/node/rollup.npm.config.mjs b/packages/node/rollup.npm.config.mjs index 45f7f66a6df4..b1262c0c1f50 100644 --- a/packages/node/rollup.npm.config.mjs +++ b/packages/node/rollup.npm.config.mjs @@ -1,4 +1,3 @@ -import replace from '@rollup/plugin-replace'; import { makeBaseNPMConfig, makeNPMConfigVariants, makeOrchestrionLoader } from '@sentry-internal/rollup-utils'; import { createWorkerCodeBuilder } from './rollup.anr-worker.config.mjs'; @@ -12,6 +11,23 @@ const [localVariablesWorkerConfig, getLocalVariablesBase64Code] = createWorkerCo 'build/esm/integrations/local-variables', ); +// The worker configs above only produce their base64 payload once their own `renderChunk` has run, +// so the placeholder values have to be read lazily. Rolldown's builtin replace plugin takes plain +// strings up front, which would capture the (still empty) payload at config time. +function makeLazyReplacePlugin(replacements, { delimiters: [delimiterStart, delimiterEnd] }) { + return { + name: 'lazy-replace-plugin', + renderChunk(code) { + const replaced = Object.entries(replacements).reduce( + (result, [key, getValue]) => result.split(`${delimiterStart}${key}${delimiterEnd}`).join(getValue()), + code, + ); + + return replaced === code ? null : { code: replaced }; + }, + }; +} + export default [ // The `@sentry/node/import` entry (`node --import @sentry/node/import app.js`), which registers // the orchestrion diagnostics-channel injection before the app loads. @@ -38,15 +54,13 @@ export default [ preserveModules: true, }, plugins: [ - replace({ - delimiters: ['###', '###'], - // removes some rollup warnings - preventAssignment: true, - values: { - AnrWorkerScript: () => getAnrBase64Code(), - LocalVariablesWorkerScript: () => getLocalVariablesBase64Code(), + makeLazyReplacePlugin( + { + AnrWorkerScript: getAnrBase64Code, + LocalVariablesWorkerScript: getLocalVariablesBase64Code, }, - }), + { delimiters: ['###', '###'] }, + ), ], }, }), diff --git a/packages/node/src/integrations/fs/vendored/instrumentation.ts b/packages/node/src/integrations/fs/vendored/instrumentation.ts index 911782138721..9150a08b4e9a 100644 --- a/packages/node/src/integrations/fs/vendored/instrumentation.ts +++ b/packages/node/src/integrations/fs/vendored/instrumentation.ts @@ -12,6 +12,10 @@ * - Completely reworked to no longer reference OpenTelemetry. * - The upstream `fs_error` span attribute (the error message) was replaced with the conventions-backed * `error.type` (the syscall error code, e.g. `ENOENT`). + * - `fs` is default-imported rather than namespace-imported. A namespace import compiles to a copied + * namespace object whose properties are getter-only, so the patching below would write to the copy + * and leave the real module untouched. The default export is the module itself in both output + * formats, so patching it reaches every other consumer of `require('fs')` / `import 'fs'`. */ import { ERROR_TYPE } from '@sentry/conventions/attributes'; @@ -26,7 +30,7 @@ import { suppressTracing, withActiveSpan, } from '@sentry/core'; -import * as fs from 'fs'; +import fs from 'fs'; import { promisify } from 'util'; import { CALLBACK_FUNCTIONS, PROMISE_FUNCTIONS, SYNC_FUNCTIONS } from './constants'; import type { FMember, FPMember, FsInstrumentationConfig, GenericFunction } from './types'; diff --git a/packages/node/test/integrations/nodeRuntimeMetrics.test.ts b/packages/node/test/integrations/nodeRuntimeMetrics.test.ts index f5dd76edf779..fd3e239d2be0 100644 --- a/packages/node/test/integrations/nodeRuntimeMetrics.test.ts +++ b/packages/node/test/integrations/nodeRuntimeMetrics.test.ts @@ -1,7 +1,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { metrics } from '@sentry/core'; import { nodeRuntimeMetricsIntegration } from '../../src/integrations/nodeRuntimeMetrics'; +const { mockGauge, mockCount } = vi.hoisted(() => ({ mockGauge: vi.fn(), mockCount: vi.fn() })); + const { mockHistogram, mockMonitorEventLoopDelay, mockPerformance } = vi.hoisted(() => { const mockHistogram = { min: 2_000_000, @@ -38,17 +39,14 @@ vi.mock('perf_hooks', () => ({ vi.mock('@sentry/core', async () => { const actual = await vi.importActual('@sentry/core'); - return { ...actual }; + return { ...actual, metrics: { ...actual.metrics, gauge: mockGauge, count: mockCount } }; }); describe('nodeRuntimeMetricsIntegration', () => { - let gaugeSpy: ReturnType; - let countSpy: ReturnType; - beforeEach(() => { vi.useFakeTimers(); - gaugeSpy = vi.spyOn(metrics, 'gauge'); - countSpy = vi.spyOn(metrics, 'count'); + mockGauge.mockClear(); + mockCount.mockClear(); vi.spyOn(process, 'cpuUsage').mockReturnValue({ user: 500_000, system: 200_000 }); vi.spyOn(process, 'memoryUsage').mockReturnValue({ @@ -98,9 +96,9 @@ describe('nodeRuntimeMetricsIntegration', () => { const integration = nodeRuntimeMetricsIntegration({ collectionIntervalMs: 1_000 }); integration.setup(); - expect(gaugeSpy).not.toHaveBeenCalled(); + expect(mockGauge).not.toHaveBeenCalled(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalled(); + expect(mockGauge).toHaveBeenCalled(); }); }); @@ -114,7 +112,7 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.cpu.utilization', expect.any(Number), ORIGIN); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.cpu.utilization', expect.any(Number), ORIGIN); }); it('does not emit cpu.user / cpu.system by default (opt-in)', () => { @@ -122,8 +120,8 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith('node.runtime.cpu.user', expect.anything(), expect.anything()); - expect(gaugeSpy).not.toHaveBeenCalledWith('node.runtime.cpu.system', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('node.runtime.cpu.user', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('node.runtime.cpu.system', expect.anything(), expect.anything()); }); it('emits cpu.user / cpu.system when cpuTime is opted in', () => { @@ -134,8 +132,8 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.cpu.user', expect.any(Number), SECOND); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.cpu.system', expect.any(Number), SECOND); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.cpu.user', expect.any(Number), SECOND); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.cpu.system', expect.any(Number), SECOND); }); it('emits mem.rss, mem.heap_used, mem.heap_total (default on)', () => { @@ -143,9 +141,9 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.mem.rss', 50_000_000, BYTE); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.mem.heap_used', 20_000_000, BYTE); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.mem.heap_total', 30_000_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.mem.rss', 50_000_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.mem.heap_used', 20_000_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.mem.heap_total', 30_000_000, BYTE); }); it('does not emit mem.external / mem.array_buffers by default (opt-in)', () => { @@ -153,8 +151,12 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith('node.runtime.mem.external', expect.anything(), expect.anything()); - expect(gaugeSpy).not.toHaveBeenCalledWith('node.runtime.mem.array_buffers', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('node.runtime.mem.external', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith( + 'node.runtime.mem.array_buffers', + expect.anything(), + expect.anything(), + ); }); it('emits mem.external / mem.array_buffers when opted in', () => { @@ -165,8 +167,8 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.mem.external', 1_000_000, BYTE); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.mem.array_buffers', 500_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.mem.external', 1_000_000, BYTE); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.mem.array_buffers', 500_000, BYTE); }); it('emits event_loop.delay.p50 and p99 (default on) and resets histogram', () => { @@ -174,8 +176,8 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.event_loop.delay.p50', expect.any(Number), SECOND); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.event_loop.delay.p99', expect.any(Number), SECOND); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.event_loop.delay.p50', expect.any(Number), SECOND); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.event_loop.delay.p99', expect.any(Number), SECOND); expect(mockHistogram.reset).toHaveBeenCalledOnce(); }); @@ -185,7 +187,7 @@ describe('nodeRuntimeMetricsIntegration', () => { vi.advanceTimersByTime(1_000); for (const suffix of ['min', 'max', 'mean', 'p90']) { - expect(gaugeSpy).not.toHaveBeenCalledWith( + expect(mockGauge).not.toHaveBeenCalledWith( `node.runtime.event_loop.delay.${suffix}`, expect.anything(), expect.anything(), @@ -207,11 +209,11 @@ describe('nodeRuntimeMetricsIntegration', () => { vi.advanceTimersByTime(1_000); // min: (2_000_000 - 10_000_000) clamped to 0 → 0s - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.event_loop.delay.min', 0, SECOND); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.event_loop.delay.min', 0, SECOND); // max: (20_000_000 - 10_000_000) / 1e9 → 0.01s - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.event_loop.delay.max', 0.01, SECOND); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.event_loop.delay.mean', 0, SECOND); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.event_loop.delay.p90', expect.any(Number), SECOND); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.event_loop.delay.max', 0.01, SECOND); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.event_loop.delay.mean', 0, SECOND); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.event_loop.delay.p90', expect.any(Number), SECOND); }); it('emits event loop utilization metric', () => { @@ -219,7 +221,7 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.event_loop.utilization', 0.3, ORIGIN); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.event_loop.utilization', 0.3, ORIGIN); }); it('emits uptime counter', () => { @@ -227,7 +229,7 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(countSpy).toHaveBeenCalledWith('node.runtime.process.uptime', expect.any(Number), SECOND); + expect(mockCount).toHaveBeenCalledWith('node.runtime.process.uptime', expect.any(Number), SECOND); }); it('does not emit event loop delay metrics if monitorEventLoopDelay threw', () => { @@ -239,7 +241,7 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith( + expect(mockGauge).not.toHaveBeenCalledWith( 'node.runtime.event_loop.delay.p99', expect.anything(), expect.anything(), @@ -256,7 +258,7 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith('node.runtime.cpu.utilization', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('node.runtime.cpu.utilization', expect.anything(), expect.anything()); }); it('skips mem.rss when memRss is false', () => { @@ -267,7 +269,7 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith('node.runtime.mem.rss', expect.anything(), expect.anything()); + expect(mockGauge).not.toHaveBeenCalledWith('node.runtime.mem.rss', expect.anything(), expect.anything()); }); it('skips event loop delay metrics when all delay flags are false', () => { @@ -280,7 +282,7 @@ describe('nodeRuntimeMetricsIntegration', () => { expect(mockMonitorEventLoopDelay).not.toHaveBeenCalled(); vi.advanceTimersByTime(1_000); for (const suffix of ['min', 'max', 'mean', 'p50', 'p90', 'p99']) { - expect(gaugeSpy).not.toHaveBeenCalledWith( + expect(mockGauge).not.toHaveBeenCalledWith( `node.runtime.event_loop.delay.${suffix}`, expect.anything(), expect.anything(), @@ -296,12 +298,12 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith( + expect(mockGauge).not.toHaveBeenCalledWith( 'node.runtime.event_loop.delay.p99', expect.anything(), expect.anything(), ); - expect(gaugeSpy).toHaveBeenCalledWith('node.runtime.event_loop.delay.p50', expect.any(Number), SECOND); + expect(mockGauge).toHaveBeenCalledWith('node.runtime.event_loop.delay.p50', expect.any(Number), SECOND); }); it('skips event loop utilization when eventLoopUtilization is false', () => { @@ -312,7 +314,7 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(gaugeSpy).not.toHaveBeenCalledWith( + expect(mockGauge).not.toHaveBeenCalledWith( 'node.runtime.event_loop.utilization', expect.anything(), expect.anything(), @@ -327,7 +329,7 @@ describe('nodeRuntimeMetricsIntegration', () => { integration.setup(); vi.advanceTimersByTime(1_000); - expect(countSpy).not.toHaveBeenCalledWith('node.runtime.process.uptime', expect.anything(), expect.anything()); + expect(mockCount).not.toHaveBeenCalledWith('node.runtime.process.uptime', expect.anything(), expect.anything()); }); it('enforces minimum collectionIntervalMs of 1000ms and warns', () => { @@ -341,10 +343,10 @@ describe('nodeRuntimeMetricsIntegration', () => { // Should fire at the minimum 1000ms, not at 100ms vi.advanceTimersByTime(100); - expect(gaugeSpy).not.toHaveBeenCalled(); + expect(mockGauge).not.toHaveBeenCalled(); vi.advanceTimersByTime(900); - expect(gaugeSpy).toHaveBeenCalled(); + expect(mockGauge).toHaveBeenCalled(); warnSpy.mockRestore(); }); @@ -359,10 +361,10 @@ describe('nodeRuntimeMetricsIntegration', () => { // Should fire at the default 30000ms, not at 1000ms vi.advanceTimersByTime(1000); - expect(gaugeSpy).not.toHaveBeenCalled(); + expect(mockGauge).not.toHaveBeenCalled(); vi.advanceTimersByTime(29_000); - expect(gaugeSpy).toHaveBeenCalled(); + expect(mockGauge).toHaveBeenCalled(); warnSpy.mockRestore(); }); diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 3f4183217348..f5f2cd19011b 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -74,12 +74,13 @@ "scripts": { "build": "run-s build:types build:transpile", "build:dev": "yarn build", - "build:nuxt-module": "rollup -c rollup.module.config.mjs && tsc -p tsconfig.module.json && node scripts/build-module-meta.mjs", - "build:transpile": "rollup -c rollup.npm.config.mjs && yarn build:nuxt-module", + "build:nuxt-module": "rolldown -c rollup.module.config.mjs && tsc -p tsconfig.module.json && node scripts/build-module-meta.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs && yarn build:nuxt-module", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", "clean": "rimraf build coverage sentry-nuxt-*.tgz", diff --git a/packages/nuxt/rollup.module.config.mjs b/packages/nuxt/rollup.module.config.mjs index f53676433cef..c5a5c354c0a0 100644 --- a/packages/nuxt/rollup.module.config.mjs +++ b/packages/nuxt/rollup.module.config.mjs @@ -1,26 +1,17 @@ import { readdirSync } from 'node:fs'; import { join } from 'node:path'; -import esbuild from 'rollup-plugin-esbuild'; // The Nuxt module ships two kinds of output that live side by side in `build/module`: // - `module.mjs`: the module entry, bundled from `src/module.ts`. // - `runtime/**`: the files Nuxt injects into the consuming app, emitted one-to-one // (never bundled) because the app's own build re-processes them. -// This config replaces `@nuxt/module-builder` so the package builds with plain rollup + tsc +// This config replaces `@nuxt/module-builder` so the package builds with plain rolldown + tsc // and doesn't couple us to a build tool that consumes the TypeScript compiler API. // Anything that isn't a relative path is provided by the consuming app or Node at runtime // (this covers `@sentry/*`, `nuxt/app`, `#imports`, node builtins), so it stays external. const isExternal = id => !id.startsWith('.') && !id.startsWith('/') && !id.startsWith('\0'); -const transpile = esbuild({ - target: 'es2020', - // Don't read a per-package tsconfig; pin only what affects codegen. - tsconfig: false, - tsconfigRaw: { compilerOptions: { useDefineForClassFields: false } }, - sourceMap: false, -}); - function runtimeEntrypoints(dir = 'src/runtime', acc = []) { for (const entry of readdirSync(dir, { withFileTypes: true })) { const full = join(dir, entry.name); @@ -34,23 +25,27 @@ function runtimeEntrypoints(dir = 'src/runtime', acc = []) { return acc; } +// Don't read a per-package tsconfig; pin only what affects codegen. +const transpile = { tsconfig: false, transform: { target: 'es2020' } }; + export default [ { + ...transpile, input: 'src/module.ts', - output: { file: 'build/module/module.mjs', format: 'esm' }, + output: { file: 'build/module/module.mjs', format: 'esm', sourcemap: false }, external: isExternal, - plugins: [transpile], }, { + ...transpile, input: runtimeEntrypoints(), output: { dir: 'build/module/runtime', format: 'esm', + sourcemap: false, preserveModules: true, preserveModulesRoot: 'src/runtime', entryFileNames: '[name].js', }, external: isExternal, - plugins: [transpile], }, ]; diff --git a/packages/opentelemetry/package.json b/packages/opentelemetry/package.json index 3b240e32778f..16d04f9ad89e 100644 --- a/packages/opentelemetry/package.json +++ b/packages/opentelemetry/package.json @@ -39,11 +39,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-opentelemetry-*.tgz", diff --git a/packages/profiling-node/package.json b/packages/profiling-node/package.json index ae8b355ed7a2..1cf8907a1d36 100644 --- a/packages/profiling-node/package.json +++ b/packages/profiling-node/package.json @@ -38,11 +38,12 @@ "lint:es-compatibility": "es-check es2022 ./build/cjs/*.js && es-check es2022 ./build/esm/*.js --module", "lint:fix": "oxlint . --fix --type-aware", "build": "yarn build:types && yarn build:transpile", - "build:transpile": "yarn rollup -c rollup.npm.config.mjs", + "build:transpile": "yarn rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:dev": "yarn clean && yarn build", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", - "build:watch": "run-p build:transpile:watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", + "build:watch": "run-p build:transpile:watch build:types:watch", "build:tarball": "npm pack", "test:bundle": "node test-binaries.esbuild.js", "test": "vitest run", diff --git a/packages/react-router/package.json b/packages/react-router/package.json index d1081136e851..56c1985df4c9 100644 --- a/packages/react-router/package.json +++ b/packages/react-router/package.json @@ -76,12 +76,13 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "run-s build:types:core", "build:types:core": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", "clean": "rimraf build coverage sentry-react-router-*.tgz", diff --git a/packages/react/package.json b/packages/react/package.json index 6514b4f9637c..1129cab42f21 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -65,11 +65,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-react-*.tgz", diff --git a/packages/remix/package.json b/packages/remix/package.json index f62489630526..77bb9084de17 100644 --- a/packages/remix/package.json +++ b/packages/remix/package.json @@ -79,11 +79,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.server.ts && madge --circular src/index.client.ts", "clean": "rimraf build coverage sentry-remix-*.tgz", diff --git a/packages/replay-canvas/package.json b/packages/replay-canvas/package.json index 2db4d01bdf20..2666f901db12 100644 --- a/packages/replay-canvas/package.json +++ b/packages/replay-canvas/package.json @@ -25,8 +25,8 @@ "sideEffects": false, "scripts": { "build": "run-p build:transpile build:types build:bundle", - "build:transpile": "rollup -c rollup.npm.config.mjs", - "build:bundle": "rollup -c rollup.bundle.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", + "build:bundle": "rolldown -c rollup.bundle.config.mjs", "build:dev": "run-p build:transpile build:types", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch build:bundle:watch", diff --git a/packages/replay-canvas/src/canvas.ts b/packages/replay-canvas/src/canvas.ts index 5f477d386324..14924e2782f7 100644 --- a/packages/replay-canvas/src/canvas.ts +++ b/packages/replay-canvas/src/canvas.ts @@ -1,7 +1,7 @@ import type { Integration, IntegrationFn } from '@sentry/core'; import { defineIntegration } from '@sentry/core'; import type { CanvasManagerInterface, CanvasManagerOptions } from '@sentry/replay'; -import { CanvasManager } from '@sentry/rrweb'; +import { CanvasManager } from '@sentry/rrweb/canvas-manager'; interface SnapshotOptions { skipRequestAnimationFrame?: boolean; diff --git a/packages/replay-canvas/test/canvas.test.ts b/packages/replay-canvas/test/canvas.test.ts index e02c284d2dac..ce75368f93c4 100644 --- a/packages/replay-canvas/test/canvas.test.ts +++ b/packages/replay-canvas/test/canvas.test.ts @@ -2,11 +2,11 @@ * @vitest-environment jsdom */ -import { CanvasManager } from '@sentry/rrweb'; +import { CanvasManager } from '@sentry/rrweb/canvas-manager'; import { beforeEach, expect, it, vi } from 'vitest'; import { _replayCanvasIntegration, replayCanvasIntegration } from '../src/canvas'; -vi.mock('@sentry/rrweb'); +vi.mock('@sentry/rrweb/canvas-manager'); beforeEach(() => { vi.clearAllMocks(); diff --git a/packages/replay-internal/package.json b/packages/replay-internal/package.json index 08b03041f7b9..ce0f908f89dc 100644 --- a/packages/replay-internal/package.json +++ b/packages/replay-internal/package.json @@ -39,8 +39,8 @@ }, "scripts": { "build": "run-p build:transpile build:types build:bundle", - "build:transpile": "rollup -c rollup.npm.config.mjs", - "build:bundle": "rollup -c rollup.bundle.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", + "build:bundle": "rolldown -c rollup.bundle.config.mjs", "build:dev": "run-p build:transpile build:types", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch build:bundle:watch", diff --git a/packages/replay-internal/rollup.npm.config.mjs b/packages/replay-internal/rollup.npm.config.mjs index 4cf2b0263eac..47aa785d5ad1 100644 --- a/packages/replay-internal/rollup.npm.config.mjs +++ b/packages/replay-internal/rollup.npm.config.mjs @@ -1,5 +1,3 @@ -/* eslint-disable import/no-named-as-default */ -import nodeResolve from '@rollup/plugin-node-resolve'; import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; export default makeNPMConfigVariants( @@ -20,10 +18,12 @@ export default makeNPMConfigVariants( input: ['./src/worker-bundler.ts'], output: { file: `./build/npm/${format}/worker-bundler.js`, - strict: false, format, + minify: true, }, treeshake: false, - plugins: [nodeResolve()], + transform: { + target: 'es2020', + }, })), ); diff --git a/packages/replay-worker/package.json b/packages/replay-worker/package.json index 29d1ce0027bf..ea0e3a54cd1b 100644 --- a/packages/replay-worker/package.json +++ b/packages/replay-worker/package.json @@ -29,8 +29,8 @@ "private": true, "scripts": { "build": "run-p build:transpile build:types", - "build:transpile": "rollup -c rollup.worker.config.mjs", - "build:examples": "rollup -c rollup.examples.config.mjs", + "build:transpile": "rolldown -c rollup.worker.config.mjs", + "build:examples": "rolldown -c rollup.examples.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:dev": "yarn build", "build:watch": "run-p build:transpile:watch", diff --git a/packages/replay-worker/rollup.examples.config.mjs b/packages/replay-worker/rollup.examples.config.mjs index 7ca68e89556d..207036538f12 100644 --- a/packages/replay-worker/rollup.examples.config.mjs +++ b/packages/replay-worker/rollup.examples.config.mjs @@ -1,42 +1,24 @@ -import commonjs from '@rollup/plugin-commonjs'; -import resolve from '@rollup/plugin-node-resolve'; -import terser from '@rollup/plugin-terser'; -import { defineConfig } from 'rollup'; -import esbuild from 'rollup-plugin-esbuild'; -import { makeLicensePlugin } from '../../dev-packages/rollup-utils/plugins/index.mjs'; - -const licensePlugin = makeLicensePlugin('Sentry Replay Worker'); - -const esbuildPlugin = esbuild({ tsconfig: './tsconfig.json', target: 'es2020', sourceMap: false }); +import { treeShakePreset } from '@sentry-internal/rollup-utils'; +import { defineConfig } from 'rolldown'; const config = defineConfig([ { input: ['./src/_worker.ts'], + tsconfig: './tsconfig.build.json', output: { file: './examples/worker.js', format: 'esm', }, - treeshake: 'smallest', - plugins: [commonjs(), esbuildPlugin, resolve(), licensePlugin], + treeshake: treeShakePreset('smallest'), }, { input: ['./src/_worker.ts'], + tsconfig: './tsconfig.build.json', output: { file: './examples/worker.min.js', format: 'esm', }, - treeshake: 'smallest', - plugins: [ - commonjs(), - esbuildPlugin, - resolve(), - terser({ - mangle: { - module: true, - }, - }), - licensePlugin, - ], + treeshake: treeShakePreset('smallest'), }, ]); diff --git a/packages/replay-worker/rollup.worker.config.mjs b/packages/replay-worker/rollup.worker.config.mjs index 36f18cb2a7e6..6e8bff38a354 100644 --- a/packages/replay-worker/rollup.worker.config.mjs +++ b/packages/replay-worker/rollup.worker.config.mjs @@ -1,47 +1,36 @@ // inspired by https://justinribeiro.com/chronicle/2020/07/17/building-module-web-workers-for-cross-browser-compatibility-with-rollup/ -import commonjs from '@rollup/plugin-commonjs'; -import resolve from '@rollup/plugin-node-resolve'; -import terser from '@rollup/plugin-terser'; -import { defineConfig } from 'rollup'; -import esbuild from 'rollup-plugin-esbuild'; - -const esbuildPlugin = esbuild({ tsconfig: './tsconfig.json', target: 'es2020', sourceMap: false }); +import { treeShakePreset } from '@sentry-internal/rollup-utils'; +import { defineConfig } from 'rolldown'; const config = defineConfig([ { input: ['./src/index.ts'], - treeshake: 'smallest', + treeshake: treeShakePreset('smallest'), + tsconfig: './tsconfig.build.json', output: { dir: './build/esm', format: 'esm', + minify: true, + }, + transform: { + target: 'es2020', }, external: ['./worker'], - plugins: [ - esbuildPlugin, - terser({ - mangle: { - module: true, - }, - }), - ], }, { input: ['./src/_worker.ts'], + tsconfig: './tsconfig.build.json', output: { file: './build/esm/worker.ts', format: 'esm', + minify: true, + }, + treeshake: treeShakePreset('smallest'), + transform: { + target: 'es2020', }, - treeshake: 'smallest', plugins: [ - commonjs(), - esbuildPlugin, - resolve(), - terser({ - mangle: { - module: true, - }, - }), { name: 'worker-to-string', renderChunk(code) { @@ -52,21 +41,16 @@ const config = defineConfig([ }, { input: ['./src/_worker.ts'], + tsconfig: './tsconfig.build.json', output: { file: './build/esm/worker-bundler.js', format: 'esm', + minify: true, + }, + treeshake: treeShakePreset('smallest'), + transform: { + target: 'es2020', }, - treeshake: 'smallest', - plugins: [ - commonjs(), - esbuildPlugin, - resolve(), - terser({ - mangle: { - module: true, - }, - }), - ], }, ]); diff --git a/packages/replay-worker/tsconfig.build.json b/packages/replay-worker/tsconfig.build.json new file mode 100644 index 000000000000..24cce469ccc3 --- /dev/null +++ b/packages/replay-worker/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "module": "esnext", + "lib": ["webworker", "scripthost"], + "esModuleInterop": true, + "target": "es2020", + "strictPropertyInitialization": false + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/replay-worker/tsconfig.json b/packages/replay-worker/tsconfig.json index bfa37b859232..85dfc8da1d33 100644 --- a/packages/replay-worker/tsconfig.json +++ b/packages/replay-worker/tsconfig.json @@ -4,7 +4,10 @@ "lib": ["webworker", "scripthost"], "esModuleInterop": true, "target": "es2020", - "strictPropertyInitialization": false + "strictPropertyInitialization": false, + "inlineSourceMap": false, + "sourceMap": false, + "inlineSources": false }, "include": ["src/**/*.ts"] } diff --git a/packages/server-utils/package.json b/packages/server-utils/package.json index 3b9c5294f10e..d774e7a4618f 100644 --- a/packages/server-utils/package.json +++ b/packages/server-utils/package.json @@ -108,11 +108,11 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "run-p build:transpile:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", "build:tarball": "npm pack", "clean": "rimraf build coverage sentry-server-utils-*.tgz", "lint:fix": "oxlint . --fix --type-aware", diff --git a/packages/server-utils/rollup.npm.config.mjs b/packages/server-utils/rollup.npm.config.mjs index 6b7c30b5a292..edecb3173598 100644 --- a/packages/server-utils/rollup.npm.config.mjs +++ b/packages/server-utils/rollup.npm.config.mjs @@ -1,7 +1,6 @@ import { builtinModules } from 'node:module'; -import commonjs from '@rollup/plugin-commonjs'; import license from 'rollup-plugin-license'; -import { defineConfig } from 'rollup'; +import { defineConfig } from 'rolldown'; import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; // The orchestrion runtime dependency chain (`@apm-js-collab/tracing-hooks` → @@ -24,25 +23,73 @@ import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollu // build-time and runtime transforms always ship the same `code-transformer` version, and so this // package has no `@apm-js-collab/*` install footprint at all. // -// `requireReturnsDefault: 'auto'`: node-resolve prefers a dependency's ESM build even for CJS -// `require()`s inside the vendored graph. Default-export-only ESM (e.g. esquery) must then resolve -// to the default itself, not a `{ default }` namespace — CJS callers use it as -// `require('esquery').parse(...)`. +// Rolldown converts CommonJS natively, so the `@rollup/plugin-commonjs` instance this config used +// to carry (and its `transformMixedEsModules` / `requireReturnsDefault` / `strictRequires` tuning) +// is gone. What it does not do is convert the vendored graph's `require()` of node builtins: those +// survive into the ESM build as rolldown's `__require` helper, which throws in every ESM runtime +// (plain Node ESM included, since `require` is not defined there). // -// `strictRequires: false`: the default `'auto'` wraps conditionally-required modules (e.g. -// `debug`'s browser/node split) in lazy initializers exported as `__require` — an export name that -// downstream re-bundlers mishandle (Turbopack renames it, producing `.require is not a function` -// crashes in Next.js on Cloudflare). Hoisting is safe here: the vendored graph is closed (nothing -// optional/missing) and has no require cycles that depend on lazy evaluation. -const commonJSOptions = { transformMixedEsModules: true, requireReturnsDefault: 'auto', strictRequires: false }; -const commonJSPlugin = commonjs(commonJSOptions); +// Neither knob rolldown offers fixes it. `platform: 'node'` makes `__require` a real +// `createRequire(import.meta.url)`, but that lands a static `node:module` import in the *shared* +// runtime chunk, which every module here imports for `__toESM` - including the entry +// `@sentry/vercel-edge` pulls in, so edge and browser bundlers then fail to resolve `node:`. And +// evaluating `createRequire(import.meta.url)` at module scope crashes with ERR_INVALID_ARG_VALUE +// once a downstream bundler re-bundles our ESM to CJS (see node-integration-tests' `esbuild` suite). +// +// So do what the commonjs plugin used to: turn each `require('')` into a static import. +// `preserveModules` gives every vendored file its own chunk, so the `node:` imports land only in +// the Node-only chunks that actually need them and never in the shared runtime chunk. +function makeBuiltinRequireShim() { + let replaced = false; + + return { + name: 'builtin-require-shim', + renderChunk(code, _chunk, outputOptions) { + // The CJS variant has a real `require`; rolldown never emits the helper there. + if (outputOptions.format !== 'es' && outputOptions.format !== 'esm') return null; + + const imports = new Map(); + // Built per call: rolldown renders chunks concurrently, and a shared global regex would + // carry `lastIndex` across those calls and skip matches. + const rewritten = code.replace(/__require\("([^"]+)"\)/g, (_match, specifier) => { + const bare = specifier.replace(/^node:/, ''); + if (!builtinModules.includes(bare)) { + throw new Error( + `The vendored graph \`require()\`s "${specifier}", which is not a node builtin. This shim only knows how to hoist builtins into static imports - handle that dependency explicitly instead.`, + ); + } + + const identifier = `__sentryRequire_${bare.replace(/[^a-zA-Z0-9]/g, '_')}`; + imports.set(identifier, specifier); + + return identifier; + }); + + if (!imports.size) return null; + replaced = true; + + const preamble = [...imports].map(([identifier, specifier]) => `import ${identifier} from "${specifier}";`); + + return { code: `${preamble.join('\n')}\n${rewritten}` }; + }, + generateBundle(outputOptions) { + if (outputOptions.format !== 'es' && outputOptions.format !== 'esm') return; + + if (!replaced) { + throw new Error( + 'Expected rolldown to emit `__require(...)` calls for the vendored graph so they could be hoisted into static imports, but no chunk contained one. Rolldown likely changed how it compiles `require()` of externals - re-check this shim against the emitted chunks.', + ); + } + replaced = false; + }, + }; +} // Always vendor `debug`'s Node build. Its default entry picks browser vs node at require time, -// which drags the browser build into this server-only bundle — and, hoisted by -// `strictRequires: false`, the browser build's storage detection probes `localStorage` at import -// time, which on Node >= 26 emits an ExperimentalWarning that pollutes stderr and console -// breadcrumbs in every user app. `order: 'pre'` because the base config's node-resolve plugin -// sorts ahead of package-specific plugins and would otherwise resolve `debug` first. +// which drags the browser build into this server-only bundle, and the browser build's storage +// detection probes `localStorage` at import time, which on Node >= 26 emits an ExperimentalWarning +// that pollutes stderr and console breadcrumbs in every user app. `order: 'pre'` so this wins over +// rolldown's own resolution. const debugNodeAlias = { name: 'debug-node-alias', resolveId: { @@ -53,8 +100,8 @@ const debugNodeAlias = { }, }; -// Bundling files from the repo-root `node_modules` moves rollup's common source ancestor up to the -// repo root, so `preserveModules` names our own files `packages/server-utils/src/...` — strip that +// Bundling files from the repo-root `node_modules` moves the common source ancestor up to the repo +// root, so `preserveModules` names our own files `packages/server-utils/src/...` — strip that // prefix to keep the `build/cjs/index.js` layout the `exports` map points at. And npm never packs // `node_modules` directories, so the vendored dependencies must not be emitted under that name. const sanitizedFileNames = info => @@ -66,7 +113,9 @@ const sanitizedFileNames = info => // banners, so instead we aggregate them into a single `build/THIRD-PARTY-LICENSES.txt`. The default // template emits each dependency's license text AND its NOTICE text, which covers the MIT/ISC/BSD // notice requirement and the Apache-2.0 §4(d) NOTICE requirement. Only bundled (non-external) -// packages are collected — our own `@sentry/*` deps stay external and are excluded. +// packages are collected — our own `@sentry/*` deps stay external and are excluded. The plugin only +// uses hooks rolldown implements (`renderChunk` / `generateBundle` plus `this.getModuleIds()`), so +// it keeps working unchanged on rolldown. // // Both the CJS and ESM build variants run this and bundle the same dependency set, so each writes // the same file; the last write wins and the content is identical. @@ -123,18 +172,13 @@ export default [ 'src/orchestrion/bundler/esbuild.ts', ], packageSpecificConfig: { - plugins: [debugNodeAlias, commonJSPlugin, thirdPartyLicensePlugin], + plugins: [debugNodeAlias, thirdPartyLicensePlugin, makeBuiltinRequireShim()], output: { // set exports to 'named' or 'auto' so that rollup doesn't warn exports: 'named', // set preserveModules to true because we don't want to bundle everything into one file. preserveModules: true, entryFileNames: sanitizedFileNames, - // The repo default `interop: 'esModule'` dereferences `.default` on default imports of - // externals. The commonjs-converted vendored dependencies import Node builtins that way - // (e.g. `require('path')` → default import of `path`), and builtins have no `.default` in - // CJS — so builtins need `'default'` interop (the module itself is the default export). - interop: id => (id && (id.startsWith('node:') || builtinModules.includes(id)) ? 'default' : 'esModule'), // The vendored dependencies import builtins unprefixed (`import … from 'tty'`), which // Deno rejects outright and vite-node (Node 26) misresolves as a relative path. Emit them // `node:`-prefixed. diff --git a/packages/solid/package.json b/packages/solid/package.json index f346c0ca40a1..740d45912404 100644 --- a/packages/solid/package.json +++ b/packages/solid/package.json @@ -85,13 +85,14 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "run-s build:types:core build:types:routers", "build:types:core": "tsc -p tsconfig.types.json", "build:types:routers": "tsc -p tsconfig.routers-types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts && madge --circular src/solidrouter.ts && madge --circular src/tanstackrouter.ts", "clean": "rimraf build coverage sentry-solid-*.tgz ./*.d.ts ./*.d.ts.map", diff --git a/packages/solidstart/package.json b/packages/solidstart/package.json index 121863d21181..81bf34f32e2d 100644 --- a/packages/solidstart/package.json +++ b/packages/solidstart/package.json @@ -102,13 +102,14 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "run-s build:types:core build:types:subexports", "build:types:core": "tsc -p tsconfig.types.json", "build:types:subexports": "tsc -p tsconfig.subexports-types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts && madge --circular src/solidrouter.client.ts && madge --circular src/solidrouter.server.ts && madge --circular src/solidrouter.ts", "clean": "rimraf build coverage sentry-solidstart-*.tgz ./*.d.ts ./*.d.ts.map ./client ./server", diff --git a/packages/svelte/package.json b/packages/svelte/package.json index b6139e5de2e9..6f1c4fed6424 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -49,11 +49,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-svelte-*.tgz", diff --git a/packages/sveltekit/package.json b/packages/sveltekit/package.json index df16b362c1d4..e416a41b047c 100644 --- a/packages/sveltekit/package.json +++ b/packages/sveltekit/package.json @@ -82,11 +82,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", "clean": "rimraf build coverage sentry-sveltekit-*.tgz", diff --git a/packages/tanstackstart-react/package.json b/packages/tanstackstart-react/package.json index 90ec9244c205..41d0fbfcfee9 100644 --- a/packages/tanstackstart-react/package.json +++ b/packages/tanstackstart-react/package.json @@ -66,7 +66,7 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", diff --git a/packages/vercel-edge/package.json b/packages/vercel-edge/package.json index a52dafe94bf3..0ac7e708cadd 100644 --- a/packages/vercel-edge/package.json +++ b/packages/vercel-edge/package.json @@ -43,11 +43,12 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", "build:watch": "run-p build:transpile:watch", "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage sentry-vercel-edge-*.tgz", diff --git a/packages/vercel-edge/rollup.npm.config.mjs b/packages/vercel-edge/rollup.npm.config.mjs index ae01f43703d0..c0daf542b1e7 100644 --- a/packages/vercel-edge/rollup.npm.config.mjs +++ b/packages/vercel-edge/rollup.npm.config.mjs @@ -1,5 +1,5 @@ -import replace from '@rollup/plugin-replace'; -import { makeBaseNPMConfig, makeNPMConfigVariants, plugins } from '@sentry-internal/rollup-utils'; +import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; +import { replacePlugin } from 'rolldown/plugins'; export default makeNPMConfigVariants( makeBaseNPMConfig({ @@ -11,14 +11,14 @@ export default makeNPMConfigVariants( preserveModules: false, }, plugins: [ - plugins.makeCommonJSPlugin({ transformMixedEsModules: true }), // Needed because various modules in the OTEL toolchain use CJS (require-in-the-middle, shimmer, etc..) - plugins.makeJsonPlugin(), // Needed because `require-in-the-middle` imports json via require - replace({ - preventAssignment: true, - values: { + replacePlugin( + { 'process.argv0': JSON.stringify(''), // needed because otel relies on process.argv0 for the default service name, but that api is not available in the edge runtime. }, - }), + { + preventAssignment: true, + }, + ), { // This plugin is needed because otel imports `performance` from `perf_hooks` and also uses it via the `performance` global. // It also imports `inspect` and `promisify` from node's `util` which are not available in the edge runtime so we need to define a polyfill. diff --git a/packages/vue/package.json b/packages/vue/package.json index f2d8bd10ebf1..d5fbde635257 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -68,13 +68,14 @@ "scripts": { "build": "run-p build:transpile build:types", "build:dev": "run-p build:transpile build:types", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "run-s build:types:core build:types:router", "build:types:core": "tsc -p tsconfig.types.json", "build:types:router": "tsc -p tsconfig.router-types.json", - "build:watch": "run-p build:transpile:watch", - "build:dev:watch": "run-p build:transpile:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:watch": "run-p build:transpile:watch build:types:watch", + "build:dev:watch": "run-p build:transpile:watch build:types:watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts && madge --circular src/tanstackrouter.ts", "clean": "rimraf build coverage sentry-vue-*.tgz", diff --git a/packages/wasm/package.json b/packages/wasm/package.json index 07e4cdd573bc..b5f3e590fb97 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -37,14 +37,15 @@ }, "scripts": { "build": "run-p build:transpile build:bundle build:types", - "build:bundle": "rollup --config rollup.bundle.config.mjs", + "build:bundle": "rolldown --config rollup.bundle.config.mjs", "build:dev": "run-p build:transpile build:types", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "rolldown -c rollup.npm.config.mjs", "build:types": "tsc -p tsconfig.types.json", - "build:watch": "run-p build:transpile:watch build:bundle:watch", - "build:bundle:watch": "rollup --config rollup.bundle.config.mjs --watch", - "build:dev:watch": "run-p build:transpile:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:watch": "run-p build:transpile:watch build:bundle:watch build:types:watch", + "build:bundle:watch": "rolldown --config rollup.bundle.config.mjs --watch", + "build:dev:watch": "run-p build:transpile:watch build:types:watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "test": "vitest run", "test:watch": "vitest --watch", diff --git a/yarn.lock b/yarn.lock index 5459bbac6742..642ade9857d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3549,14 +3549,6 @@ source-map-url "^0.4.1" terser "^5.7.0" -"@emnapi/core@1.11.1", "@emnapi/core@^1.1.0": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.11.1.tgz#b9e1064f3a6b1631e241e638eb48d736bfd372a6" - integrity sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ== - dependencies: - "@emnapi/wasi-threads" "1.2.2" - tslib "^2.4.0" - "@emnapi/core@1.4.5": version "1.4.5" resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.4.5.tgz#bfbb0cbbbb9f96ec4e2c4fd917b7bbe5495ceccb" @@ -3565,11 +3557,12 @@ "@emnapi/wasi-threads" "1.0.4" tslib "^2.4.0" -"@emnapi/runtime@1.11.1": +"@emnapi/core@^1.1.0": version "1.11.1" - resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.11.1.tgz#58f1f3d5d81a9b12f793ab688c96371901027c24" - integrity sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw== + resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.11.1.tgz#b9e1064f3a6b1631e241e638eb48d736bfd372a6" + integrity sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ== dependencies: + "@emnapi/wasi-threads" "1.2.2" tslib "^2.4.0" "@emnapi/runtime@1.4.5": @@ -5637,13 +5630,6 @@ "@emnapi/runtime" "^1.1.0" "@tybys/wasm-util" "^0.9.0" -"@napi-rs/wasm-runtime@^1.1.5": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.5.tgz#cccd6ebc40b991dea6936f9126b1b8155b6c4c95" - integrity sha512-AWPoBRJ9tsnVhor4sjO7rkni+7p+2IAEFj6cx06UgP10jkQHqay/36uRV/bFkgrh18D9vb4cr8Q0Pthskgzy+Q== - dependencies: - "@tybys/wasm-util" "^0.10.2" - "@nestjs/common@^10.0.0": version "10.4.15" resolved "https://registry.yarnpkg.com/@nestjs/common/-/common-10.4.15.tgz#27c291466d9100eb86fdbe6f7bbb4d1a6ad55f70" @@ -6602,10 +6588,10 @@ resolved "https://registry.yarnpkg.com/@oxc-parser/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.143.0.tgz#b1a93532ab5a8fb1998012b74cd7efe7bfdb1b4d" integrity sha512-ORMh3JE1s6V7ySicdRK7vgaDQnn5o+UHg9ct989PlWHbel8O9ARrmWXM6kZjrBMtNucxNayQ8g69G0VfWzhANw== -"@oxc-project/types@=0.137.0": - version "0.137.0" - resolved "https://registry.yarnpkg.com/@oxc-project/types/-/types-0.137.0.tgz#56e77f8bb221fa05f18b1cd34d73f94f0954a773" - integrity sha512-WT+Gb24i8hmvo85AIv2oEYouEXkRlKAlT9WaCa3TfLgNCN+GhrJOGZuIlMouAh38Qe4QOx26eUOVsq70qXrywA== +"@oxc-project/types@=0.146.0": + version "0.146.0" + resolved "https://sfw.security.sentry.io/npm/@oxc-project/types/-/types-0.146.0.tgz#d57a2591abbf1f6e50981b07ee24ab269530d87a" + integrity sha512-XC0QsnnhVe7sLIWmYmdPw7x5P0h4W8vUU3Nv1ySgWXtvCz8NizoAEpGXA0sOYoJQV2Rl13LgURAHQ5cI5ILCSA== "@oxc-project/types@^0.143.0": version "0.143.0" @@ -7489,84 +7475,80 @@ dependencies: web-streams-polyfill "^3.1.1" -"@rolldown/binding-android-arm64@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.2.tgz#88fd6b295a411e62b7926433a45eb5e17e68bba4" - integrity sha512-2cZ+7xRS+DBcuJBJKnfzsbleumJhBqSlJVpuzHC0nTqfd3QQ7Vx2/x5YR/D7cBamKSeWplwo82Fn9lqYUDEMfA== +"@rolldown/binding-android-arm-eabi@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.5.tgz#165b80910de7cd33f772d5b7b045b259acb7420c" + integrity sha512-DLe/i+l8ynIBY7XEQ191TeZvCoowIGa18R+dIV30GW7DiOtp74i/xX8hs8GUjW5ARV7VZuie3d6AumSmCwbeRA== -"@rolldown/binding-darwin-arm64@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.1.2.tgz#2f840f7e6501cb52370411c2fb008119f1fbf400" - integrity sha512-RkPMJnygxsgOYdkfqgpwY0/Fzm8d0VQe6HGU2/B00Xa9eqdLbrII+DOKAodbJAn3ZL1AJxGHkZRPYazgGY6Ljw== +"@rolldown/binding-android-arm64@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.5.tgz#5ed74d4b8fa56c68eb1aeb81d0d207a85b6de05c" + integrity sha512-zXcwKlQApYAOELHd8PwKDFkagYF9Wy4e0RJ+0qnzl9Pjnpj75TEG8ufv40p2J7kCEfwZAsNiuzRIyNNMWT38ig== -"@rolldown/binding-darwin-x64@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.1.2.tgz#2ed3b66dded5140d22ca2ac58d4e1c1e3143f490" - integrity sha512-Uiczh6vFhwyfd7WNe7Q7mCA4KxAiLdz7jPE/WGizfRpIieoyFuNVMmM8HqZ9HwudTkY6/AeMQwlNJ9NJijguWw== +"@rolldown/binding-darwin-arm64@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.5.tgz#6f27c7060e58ca03061fa7d50f9dc409bc377fe1" + integrity sha512-dK4QakI42nzWgJT5sm4y4y/O//D4OxM75/cH28RLV+nzIN9AY+YsbuUVrUTjlLjXR6vpyxFbSsbmNuJ6BP9sww== -"@rolldown/binding-freebsd-x64@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.1.2.tgz#d3d8603ae480a505eb8c12643c901b2a3771b875" - integrity sha512-+TpdtTRgHiJFjCVFbw311SuLk3KfytPOQQn+VlAEv+gBxYPtL7E6JS9e/tk+8CwxhIZvemJKo4rTKgfWNsKkkA== +"@rolldown/binding-darwin-x64@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.5.tgz#74ab897d134ede4072fdc6108f00193e6167ee28" + integrity sha512-fqSALaUu1Wjd1nK2uW2kJDWdLCc8lx1IcY+MTY26Aurfdx19anlzhqXOgCFbBFQnlFDTn4TC1/7Nz4Bl2mLP3A== -"@rolldown/binding-linux-arm-gnueabihf@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.1.2.tgz#bc36e0e33566bc80877fe4bca56fd32b241dbacb" - integrity sha512-4lv1/tkmi7ueIVHnyreaOeUpiZP26BH9rRy6hoYfR9310A2B9nUEVRDvBx69vx64Nr3eTPPRkyciqJJs+j9Jmw== +"@rolldown/binding-freebsd-x64@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.5.tgz#7d337f9ae4b739674e1938747118ab0676c8ef8a" + integrity sha512-/vCnNxlkxs9tKxNDcyWUePpJ/PgTzxIaVhoM5SmG8UV+GR/IcPam4VYxi7GIMo7PSDuNqlJqvprqii9NqqVCMw== -"@rolldown/binding-linux-arm64-gnu@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.1.2.tgz#6267a447e6bfc5a99eb030a6a99194ecc917a652" - integrity sha512-gBSUVO0eaWgw1JMjK3gB8BMlX2Mk148s2lTiVT3e9vjVxbl7UDfMWWY8CfIaaqiXuM9fVTMxIpUz6CAo/B6Vlw== +"@rolldown/binding-linux-arm-gnueabihf@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.5.tgz#a8195dc1091ade0f912b0613ef6500941e5615f4" + integrity sha512-abk0NLA519LxRCszmbE0jYKuQ9YPocOXTiOXOo6Yr+YAT95VH+PtqYAjOJvGKt3viEd/x4qzabAlwd5bHOOARg== -"@rolldown/binding-linux-arm64-musl@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.1.2.tgz#68fc068f5ebc1d137eecdb651d90830f330aad48" - integrity sha512-LjQP/iZLBu8o8PjIfk4x3At0/mT6h282pvz8Z5LAyhGbu/kDezyO7ea62rF5uoqmgnIYqbN/MqJ3Si3Aymi7xQ== +"@rolldown/binding-linux-arm64-gnu@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.5.tgz#40fbbb97072b1acaa3e0e8fe9774fe524e860bba" + integrity sha512-Y7eALiJ8lr0M2HH103Js+g7V34wf6snlpZLAsHI90uLhr3PVlNsbFVAXJC9d/V6BnPyKtpSwI+NcB/RLxsQxuA== -"@rolldown/binding-linux-ppc64-gnu@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.1.2.tgz#fe072f0bc3b713ae25b357651ced38d39e3d81e0" - integrity sha512-X/7bVLWelEsbyWDUSXt7zVsTniLLPIY2n1rH58qr78l9i7MNbbxBWD8gI2vRfBWf4NUXJCUuQnfZDsp32LqsfQ== +"@rolldown/binding-linux-arm64-musl@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.5.tgz#3cfe8b0f7c13de29dace9a9fc6c03081164176ab" + integrity sha512-xMvZgnbZg4YVnR/AX2b3oOPDTFYJvUVaJg5FedA/LuvexAtXibZQej4cnTkw3rjsJ/ggUROB64TdtETiim+FYA== -"@rolldown/binding-linux-s390x-gnu@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.1.2.tgz#9492609384775c6edec9bfbe5b1cbba9660dddcc" - integrity sha512-gb6dYKW/1KDorGXyy48glEBJs/sxVSC5pcVrox/pFGV4mvwSFeg2sK5L2tRkVsVlh7kueqOgg4GEcuipJcGuKg== +"@rolldown/binding-linux-ppc64-gnu@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.5.tgz#3bd890d96ae29f93718aa142ed0982f2ee2978ad" + integrity sha512-GRjeqTUDHTo5GwntsLaAMcBahG3nlpjftXWZLN73HiYQlhwEowvarFgQnRnQZtIp4keXX7quXFbG38uPZBa2EA== -"@rolldown/binding-linux-x64-gnu@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.1.2.tgz#74029d9f86d60fa9bcf2670b1480e22438203c98" - integrity sha512-JY4w85pU3iAiJVMh5nuk4/Mh9GjMsupe8MrIN53rwxAZW64GKrWeJBuN6SxQg9QTU5uB1cxyhDzW8jqRn1EABw== +"@rolldown/binding-linux-s390x-gnu@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.5.tgz#0959a0d5af22741d5787918e27aef70dc8602804" + integrity sha512-vLNTR45F2Uwc8AufkNXPmB4VliaXs+FvcheEogIzOXzO4l+LzieXF5A/TWxLy5HtqpsRCHUfd0lPVrrdgXdLHQ== -"@rolldown/binding-linux-x64-musl@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.1.2.tgz#eb3004015027a7af12f9b0ac85ffa1634015c873" - integrity sha512-xvpA7o5KCYLB0Rwscmuylb1/zHHSUx4g4xilm4prC5jP76pEUlzBmMbgpbh7bVDbId4NcfT96gN5i6mE6UDaiw== +"@rolldown/binding-linux-x64-gnu@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.5.tgz#7baa94e826328ac6f457d9e1abacffa0353e8d22" + integrity sha512-Mgj59/HTuYeK9Gz2MA+mBWKnHsAgkBSec15ZMb1st3oIfFbX7gCjOae7GydHhzcyQi9Z/7M1QuN9bR3oFqF0jQ== -"@rolldown/binding-openharmony-arm64@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.1.2.tgz#6a02c49dc0f698614f97c68c6f7c21aadc7600b1" - integrity sha512-p/ts6KBLjuk49Bp21XH77poQGt02iNz7ChgHep7tudPOaLinR/De/RHdxF8w8Yj4r/bF/bqXwH6PZrB2sA+Nvw== +"@rolldown/binding-linux-x64-musl@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.5.tgz#5f37597eaf0e22313d1e3d4be7d1be1fd332904e" + integrity sha512-mY8AP0/ichsbhAxGnLa3d3+MwV0EfgrPND2bplI3Ym8T6R2pJ0N87bvrKVwNXmdy3jnr6eQBecdqx/HMknBmpA== -"@rolldown/binding-wasm32-wasi@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.1.2.tgz#3f67c083e0762b8cd6c95e8edfe1a743d7ffdf78" - integrity sha512-VMu/wmrZ9hJzYlRhbw7jK5PODlugyKZ5mOdX78+lS8OvuFkWNQdz1pFLrI2p3P0pjXOmUZ7B48o5VnMH9QOGtg== - dependencies: - "@emnapi/core" "1.11.1" - "@emnapi/runtime" "1.11.1" - "@napi-rs/wasm-runtime" "^1.1.5" +"@rolldown/binding-openharmony-arm64@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.5.tgz#d096567af3f738cbe6aa858ab0a01aae9f357ef4" + integrity sha512-8SLssA2oweAxyRgDp789ACfRb/3P+zNRJpzZxSizxF9m8NUDQ4+3xjo8ttjhVGGw6Qxb70oZiEtIjaKikCO7Yw== -"@rolldown/binding-win32-arm64-msvc@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.1.2.tgz#a69c5a03b3ba36cb0b1154709293e0cefc9dd69c" - integrity sha512-xtUJqs8qEkuSviS0n1tsohaPuz3a1SPhZywOji4Oo+sgrJs8daEDMZ0QtqL0OS7dx8PoVpg2J/ZZycPY5I2+Zg== +"@rolldown/binding-win32-arm64-msvc@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.5.tgz#d53b911aa4e6b547b789c07747fabab2ac8c237d" + integrity sha512-vGbruD5zquhoc8D9SViXgN2FBJtNdTyQ4DtG+SWiEGlJiAzoKcZ2xp+xuXCffhubVdt0NJlTZqkeRuERy7g8Cw== -"@rolldown/binding-win32-x64-msvc@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.1.2.tgz#e1d9a6ccd29de00378f8dd6e275adbde5731d30a" - integrity sha512-85YiLQqjUKgSO/Zjnf9e0XIn5Ymrh1fLDWBeAkZqpuBR/3R8TpfoHXuyblqyQrftSSgWO9qpcHN8mkyKsLraoA== +"@rolldown/binding-win32-x64-msvc@1.2.5": + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.5.tgz#7bbd08cfda6a98de9b756472c772a36ebb7229bc" + integrity sha512-e/SXpgISz+IoqVcSSI0rx/d/he8zqLex+/rCWpnHpmVfmPIUjag9H6P7zotf0gJHwPUhQxZ/mF8tr6acebT9yw== "@rolldown/pluginutils@^1.0.0", "@rolldown/pluginutils@^1.0.1": version "1.0.1" @@ -7600,18 +7582,6 @@ magic-string "^0.30.3" picomatch "^4.0.2" -"@rollup/plugin-commonjs@^25.0.7": - version "25.0.8" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.8.tgz#c77e608ab112a666b7f2a6bea625c73224f7dd34" - integrity sha512-ZEZWTK5n6Qde0to4vS9Mr5x/0UZoqCxPVR9KRUjU4kA2sO7GEUn1fop0DAwpO6z0Nw/kJON9bDmSxdWxO/TT1A== - dependencies: - "@rollup/pluginutils" "^5.0.1" - commondir "^1.0.1" - estree-walker "^2.0.2" - glob "^8.0.3" - is-reference "1.2.1" - magic-string "^0.30.3" - "@rollup/plugin-commonjs@^29.0.2": version "29.0.2" resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-29.0.2.tgz#d2d84c49d0983d071f2ab96f4cfe02fe80abd602" @@ -7671,14 +7641,6 @@ is-module "^1.0.0" resolve "^1.22.1" -"@rollup/plugin-replace@^5.0.5": - version "5.0.7" - resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-5.0.7.tgz#150c9ee9db8031d9e4580a61a0edeaaed3d37687" - integrity sha512-PqxSfuorkHz/SPpyngLyg5GCEkOcee9M1bkxiVDr41Pd61mqP1PLOoDPbpl44SB2mQGKwV/In74gqQmGITOhEQ== - dependencies: - "@rollup/pluginutils" "^5.0.1" - magic-string "^0.30.3" - "@rollup/plugin-replace@^6.0.3": version "6.0.3" resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-6.0.3.tgz#0f82e41d81f6586ab0f81a1b48bd7fd92fcfb9a2" @@ -7687,15 +7649,6 @@ "@rollup/pluginutils" "^5.0.1" magic-string "^0.30.3" -"@rollup/plugin-terser@^0.4.4": - version "0.4.4" - resolved "https://registry.yarnpkg.com/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz#15dffdb3f73f121aa4fbb37e7ca6be9aeea91962" - integrity sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A== - dependencies: - serialize-javascript "^6.0.1" - smob "^1.0.0" - terser "^5.17.4" - "@rollup/plugin-terser@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@rollup/plugin-terser/-/plugin-terser-1.0.0.tgz#dabbc4414d127aa7d43fc5e7ea8699b9c3bc59e5" @@ -9015,13 +8968,6 @@ dependencies: tslib "^2.4.0" -"@tybys/wasm-util@^0.10.2": - version "0.10.2" - resolved "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.10.2.tgz#12b3a1b33db1f9cad4ddff1f604ab7dd00bf464e" - integrity sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg== - dependencies: - tslib "^2.4.0" - "@types/amqplib@^0.10.5": version "0.10.5" resolved "https://registry.yarnpkg.com/@types/amqplib/-/amqplib-0.10.5.tgz#fd883eddfbd669702a727fa10007b27c4c1e6ec7" @@ -12559,14 +12505,6 @@ chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - chalk@^5.3.0, chalk@^5.6.2: version "5.6.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.6.2.tgz#b1238b6e23ea337af71c7f8a295db5af0c158aea" @@ -14588,7 +14526,7 @@ es-module-lexer@^0.9.0: resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19" integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ== -es-module-lexer@^1.3.1, es-module-lexer@^1.5.4, es-module-lexer@^1.6.0, es-module-lexer@^1.7.0: +es-module-lexer@^1.3.1, es-module-lexer@^1.5.4, es-module-lexer@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.7.0.tgz#9159601561880a85f2734560a9099b2c31e5372a" integrity sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA== @@ -15085,7 +15023,7 @@ esbuild@^0.27.0: "@esbuild/win32-ia32" "0.27.7" "@esbuild/win32-x64" "0.27.7" -"esbuild@^0.27.0 || ^0.28.0", esbuild@^0.28.0, esbuild@^0.28.1, esbuild@~0.28.0: +"esbuild@^0.27.0 || ^0.28.0", esbuild@^0.28.0, esbuild@~0.28.0: version "0.28.2" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.28.2.tgz#0f43bd1bad955b72d24e2261e3abe5957ccf0816" integrity sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA== @@ -16434,13 +16372,6 @@ get-symbol-description@^1.1.0: es-errors "^1.3.0" get-intrinsic "^1.2.6" -get-tsconfig@^4.10.0: - version "4.14.0" - resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.14.0.tgz#985d85c52a9903864280ccc2448d413fbf1efed8" - integrity sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA== - dependencies: - resolve-pkg-maps "^1.0.0" - getopts@2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/getopts/-/getopts-2.3.0.tgz#71e5593284807e03e2427449d4f6712a268666f4" @@ -16542,7 +16473,7 @@ glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^8.0.0, glob@^8.0.1, glob@^8.0.3: +glob@^8.0.0, glob@^8.0.1: version "8.1.0" resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== @@ -24077,11 +24008,6 @@ resolve-pathname@^3.0.0: resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd" integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng== -resolve-pkg-maps@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f" - integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw== - resolve-url-loader@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-5.0.0.tgz#ee3142fb1f1e0d9db9524d539cfa166e9314f795" @@ -24251,29 +24177,29 @@ roarr@^7.0.4: safe-stable-stringify "^2.4.1" semver-compare "^1.0.0" -rolldown@^1.0.0, rolldown@^1.0.0-rc.15, rolldown@^1.0.0-rc.8: - version "1.1.2" - resolved "https://registry.yarnpkg.com/rolldown/-/rolldown-1.1.2.tgz#accb41e26c872ad2c5198a39c1281c7b6b844097" - integrity sha512-x0CrQQqCXWGeI8dTvFfN/Dnv3yMKT9hv5jFjlOreKAx9wqLq9wz7VvLLHyaAXC90/CpggTu9SisSbsJJTPSjNQ== +rolldown@^1.0.0, rolldown@^1.0.0-rc.15, rolldown@^1.0.0-rc.8, rolldown@^1.2.5: + version "1.2.5" + resolved "https://sfw.security.sentry.io/npm/rolldown/-/rolldown-1.2.5.tgz#1f504a7d05260a769e617d950410bbb051498c50" + integrity sha512-VD2IE5PUG4Oj8zz2VGykiYd5wbnjdIiSsNQb8Qu5B+noEp+A78mu2iVvpp27g8es14Tk9rofNs5Tku9iQCS4fA== dependencies: - "@oxc-project/types" "=0.137.0" + "@oxc-project/types" "=0.146.0" "@rolldown/pluginutils" "^1.0.0" optionalDependencies: - "@rolldown/binding-android-arm64" "1.1.2" - "@rolldown/binding-darwin-arm64" "1.1.2" - "@rolldown/binding-darwin-x64" "1.1.2" - "@rolldown/binding-freebsd-x64" "1.1.2" - "@rolldown/binding-linux-arm-gnueabihf" "1.1.2" - "@rolldown/binding-linux-arm64-gnu" "1.1.2" - "@rolldown/binding-linux-arm64-musl" "1.1.2" - "@rolldown/binding-linux-ppc64-gnu" "1.1.2" - "@rolldown/binding-linux-s390x-gnu" "1.1.2" - "@rolldown/binding-linux-x64-gnu" "1.1.2" - "@rolldown/binding-linux-x64-musl" "1.1.2" - "@rolldown/binding-openharmony-arm64" "1.1.2" - "@rolldown/binding-wasm32-wasi" "1.1.2" - "@rolldown/binding-win32-arm64-msvc" "1.1.2" - "@rolldown/binding-win32-x64-msvc" "1.1.2" + "@rolldown/binding-android-arm-eabi" "1.2.5" + "@rolldown/binding-android-arm64" "1.2.5" + "@rolldown/binding-darwin-arm64" "1.2.5" + "@rolldown/binding-darwin-x64" "1.2.5" + "@rolldown/binding-freebsd-x64" "1.2.5" + "@rolldown/binding-linux-arm-gnueabihf" "1.2.5" + "@rolldown/binding-linux-arm64-gnu" "1.2.5" + "@rolldown/binding-linux-arm64-musl" "1.2.5" + "@rolldown/binding-linux-ppc64-gnu" "1.2.5" + "@rolldown/binding-linux-s390x-gnu" "1.2.5" + "@rolldown/binding-linux-x64-gnu" "1.2.5" + "@rolldown/binding-linux-x64-musl" "1.2.5" + "@rolldown/binding-openharmony-arm64" "1.2.5" + "@rolldown/binding-win32-arm64-msvc" "1.2.5" + "@rolldown/binding-win32-x64-msvc" "1.2.5" rollup-plugin-copy-assets@^2.0.3: version "2.0.3" @@ -24282,16 +24208,6 @@ rollup-plugin-copy-assets@^2.0.3: dependencies: fs-extra "^7.0.1" -rollup-plugin-esbuild@^6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-esbuild/-/rollup-plugin-esbuild-6.2.1.tgz#c556195465bf452965686e0f21adfe306b90c219" - integrity sha512-jTNOMGoMRhs0JuueJrJqbW8tOwxumaWYq+V5i+PD+8ecSCVkuX27tGW7BXqDgoULQ55rO7IdNxPcnsWtshz3AA== - dependencies: - debug "^4.4.0" - es-module-lexer "^1.6.0" - get-tsconfig "^4.10.0" - unplugin-utils "^0.2.4" - rollup-plugin-license@^3.7.1: version "3.7.1" resolved "https://registry.yarnpkg.com/rollup-plugin-license/-/rollup-plugin-license-3.7.1.tgz#b99329f1c840142559789e3d6cb9f69e9e5b36ef" @@ -24740,7 +24656,7 @@ send@~0.19.0, send@~0.19.1: range-parser "~1.2.1" statuses "~2.0.2" -serialize-javascript@^6.0.0, serialize-javascript@^6.0.1: +serialize-javascript@^6.0.0: version "6.0.2" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== @@ -26975,14 +26891,6 @@ unpipe@~1.0.0: resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= -unplugin-utils@^0.2.4: - version "0.2.5" - resolved "https://registry.yarnpkg.com/unplugin-utils/-/unplugin-utils-0.2.5.tgz#d2fe44566ffffd7f216579bbb01184f6702e379b" - integrity sha512-gwXJnPRewT4rT7sBi/IvxKTjsms7jX7QIDLOClApuZwR49SXbrB1z2NLUZ+vDHyqCj/n58OzRRqaW+B8OZi8vg== - dependencies: - pathe "^2.0.3" - picomatch "^4.0.3" - unplugin-utils@^0.3.0, unplugin-utils@^0.3.1, unplugin-utils@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/unplugin-utils/-/unplugin-utils-0.3.2.tgz#22f6856408880b0b2d7dd974084faf94094613ef"