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-orpc/next.config.js b/dev-packages/e2e-tests/test-applications/nextjs-orpc/next.config.js index ade813b1cde3..c2c5f470b3a3 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,8 +1,8 @@ /** @type {import("next").NextConfig} */ const config = {}; -import { withSentryConfig } from '@sentry/nextjs'; +const { withSentryConfig } = require('@sentry/nextjs'); -export default withSentryConfig(config, { +module.exports = withSentryConfig(config, { disableLogger: 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 0a15260db4e8..b11d7acffa36 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/nextjs-t3/next.config.js b/dev-packages/e2e-tests/test-applications/nextjs-t3/next.config.js index b22141b67893..9209b1480ec0 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-t3/next.config.js +++ b/dev-packages/e2e-tests/test-applications/nextjs-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, { disableLogger: true, silent: true, }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-t3/package.json b/dev-packages/e2e-tests/test-applications/nextjs-t3/package.json index f6e3613b379d..63d31e3b5fb2 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-t3/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-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/sveltekit-2/vite.config.js b/dev-packages/e2e-tests/test-applications/sveltekit-2/vite.config.js index 1a410bee7e11..4b361e3eabbf 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-core-integration-tests/package.json b/dev-packages/node-core-integration-tests/package.json index cda704e0d08a..f7ac4a6fabb6 100644 --- a/dev-packages/node-core-integration-tests/package.json +++ b/dev-packages/node-core-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 **/node_modules && run-p clean:script", "clean:script": "node scripts/clean.js", diff --git a/dev-packages/node-integration-tests/package.json b/dev-packages/node-integration-tests/package.json index e9d131840e8b..56835bfd6ab8 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 8dd2ebd21999..005614f08b5b 100644 --- a/dev-packages/rollup-utils/bundleHelpers.mjs +++ b/dev-packages/rollup-utils/bundleHelpers.mjs @@ -3,48 +3,38 @@ */ import { builtinModules } from 'module'; - +import path from 'node:path'; +import fs from 'node:fs'; import deepMerge from 'deepmerge'; import { makeBrowserBuildPlugin, - makeCleanupPlugin, - makeCommonJSPlugin, makeIsDebugBuildPlugin, - makeLicensePlugin, - makeNodeResolvePlugin, makeRrwebBuildPlugin, makeSetSDKSourcePlugin, - makeSucrasePlugin, - makeTerserPlugin, + makeBannerOptions, + makeMinifierOptions, } from './plugins/index.mjs'; -import { mergePlugins } from './utils.mjs'; -import { makeProductionReplacePlugin } from './plugins/npmPlugins.mjs'; +import { mergePlugins, treeShakePreset } from './utils.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, sucrase } = options; + const { bundleType, entrypoints, licenseTitle, outputFileBase, packageSpecificConfig } = options; - const nodeResolvePlugin = makeNodeResolvePlugin(); - const sucrasePlugin = makeSucrasePlugin({}, sucrase); - const cleanupPlugin = makeCleanupPlugin(); 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: () => { @@ -52,7 +42,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) @@ -63,7 +53,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 = {};', @@ -86,14 +76,15 @@ 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, }; @@ -101,8 +92,9 @@ export function makeBaseBundleConfig(options) { 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, }; @@ -110,16 +102,22 @@ export function makeBaseBundleConfig(options) { // used by all bundles const sharedBundleConfig = { input: entrypoints, + // Point to the package's tsconfig.json so rolldown respects TypeScript & JSX settings + tsconfig: path.resolve(process.cwd(), './tsconfig.json'), + + // Enforce ES2020 target for all builds + 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, dir: 'build', sourcemap: true, - strict: false, esModule: false, }, - plugins: [productionReplacePlugin, sucrasePlugin, nodeResolvePlugin, cleanupPlugin], - treeshake: 'smallest', + treeshake: treeShakePreset('smallest'), }; const bundleTypeConfigMap = { @@ -149,7 +147,7 @@ export function makeBundleConfigVariants(baseConfig, options = {}) { const includeDebuggingPlugin = makeIsDebugBuildPlugin(true); const stripDebuggingPlugin = makeIsDebugBuildPlugin(false); - const terserPlugin = makeTerserPlugin(); + const minifierOptions = makeMinifierOptions(); const setSdkSourcePlugin = makeSetSDKSourcePlugin('cdn'); // The additional options to use for each variant we're going to create. @@ -164,15 +162,17 @@ export function makeBundleConfigVariants(baseConfig, options = {}) { '.min.js': { output: { entryFileNames: chunkInfo => `${baseConfig.output.entryFileNames(chunkInfo)}.min.js`, + minify: minifierOptions, }, - plugins: [stripDebuggingPlugin, setSdkSourcePlugin, terserPlugin], + plugins: [stripDebuggingPlugin, setSdkSourcePlugin], }, '.debug.min.js': { output: { entryFileNames: chunkInfo => `${baseConfig.output.entryFileNames(chunkInfo)}.debug.min.js`, + minify: minifierOptions, }, - plugins: [includeDebuggingPlugin, setSdkSourcePlugin, terserPlugin], + plugins: [includeDebuggingPlugin, setSdkSourcePlugin], }, }; @@ -180,6 +180,7 @@ export function makeBundleConfigVariants(baseConfig, options = {}) { if (!BUNDLE_VARIANTS.includes(variant)) { throw new Error(`Unknown bundle variant requested: ${variant}`); } + return deepMerge(baseConfig, variantSpecificConfigMap[variant], { // Merge the plugin arrays and make sure the end result is in the correct order. Everything else can use the // default merge strategy. diff --git a/dev-packages/rollup-utils/index.mjs b/dev-packages/rollup-utils/index.mjs index 2d8c9a2150bc..98527fc5ef30 100644 --- a/dev-packages/rollup-utils/index.mjs +++ b/dev-packages/rollup-utils/index.mjs @@ -1,7 +1,4 @@ -// TODO Is this necessary? -import * as plugins from './plugins/index.mjs'; -export { plugins }; - +export * from './plugins/index.mjs'; 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 d5f7428b992d..d417a27dfd23 100644 --- a/dev-packages/rollup-utils/npmHelpers.mjs +++ b/dev-packages/rollup-utils/npmHelpers.mjs @@ -8,17 +8,12 @@ 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 { - makeCleanupPlugin, makeDebugBuildStatementReplacePlugin, - makeNodeResolvePlugin, makeProductionReplacePlugin, makeRrwebBuildPlugin, - makeSucrasePlugin, } from './plugins/index.mjs'; import { makePackageNodeEsm } from './plugins/make-esm-plugin.mjs'; import { mergePlugins } from './utils.mjs'; @@ -34,22 +29,28 @@ export function makeBaseNPMConfig(options = {}) { entrypoints = ['src/index.ts'], hasBundles = false, packageSpecificConfig = {}, - sucrase = {}, bundledBuiltins = [], } = options; - const nodeResolvePlugin = makeNodeResolvePlugin(); - const sucrasePlugin = makeSucrasePlugin({}, sucrase); + // Make sure subpath imports are also treated as external (e.g., 'solid-js/web' when 'solid-js' is external) + const externalWithSubpaths = [ + ...Object.keys(packageDotJSON.dependencies || {}), + ...Object.keys(packageDotJSON.peerDependencies || {}), + ...Object.keys(packageDotJSON.optionalDependencies || {}), + ].map(dep => new RegExp(`^${dep}(?:/.*)?$`)); + const debugBuildStatementReplacePlugin = makeDebugBuildStatementReplacePlugin(); - const cleanupPlugin = makeCleanupPlugin(); const rrwebBuildPlugin = makeRrwebBuildPlugin({ excludeShadowDom: undefined, excludeIframe: undefined, }); - const defaultBaseConfig = { + const defaultBaseConfig = defineConfig({ input: entrypoints, + // Point to the package's tsconfig.json so rolldown respects TypeScript & JSX settings + tsconfig: path.resolve(process.cwd(), './tsconfig.json'), + 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', @@ -62,14 +63,14 @@ export function makeBaseNPMConfig(options = {}) { // output individual files rather than one big bundle preserveModules: true, + // output files relative to the src directory + preserveModulesRoot: 'src', + // Allow wrappers or helper functions generated by rollup to use any ES2015 features generatedCode: { preset: 'es2015', }, - // don't add `"use strict"` to the top of cjs files - strict: false, - // do TS-3.8-style exports // exports.dogs = are.great // rather than TS-3.9-style exports @@ -78,12 +79,6 @@ 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, - - interop: 'esModule', }, treeshake: { @@ -97,16 +92,16 @@ export function makeBaseNPMConfig(options = {}) { }, }, - plugins: [nodeResolvePlugin, sucrasePlugin, debugBuildStatementReplacePlugin, rrwebBuildPlugin, cleanupPlugin], + // Enforce ES2020 target for all builds + transform: { + target: 'es2020', + }, + + plugins: [debugBuildStatementReplacePlugin, rrwebBuildPlugin], // don't include imported modules from outside the package in the final output - external: [ - ...builtinModules.filter(m => !bundledBuiltins.includes(m)), - ...Object.keys(packageDotJSON.dependencies || {}), - ...Object.keys(packageDotJSON.peerDependencies || {}), - ...Object.keys(packageDotJSON.optionalDependencies || {}), - ], - }; + external: [...builtinModules.filter(m => !bundledBuiltins.includes(m)), ...externalWithSubpaths], + }); return deepMerge(defaultBaseConfig, packageSpecificConfig, { // Plugins have to be in the correct order or everything breaks, so when merging we have to manually re-order them diff --git a/dev-packages/rollup-utils/plugins/bundlePlugins.mjs b/dev-packages/rollup-utils/plugins/bundlePlugins.mjs index 9d6edd3157c0..7ace3c653e9a 100644 --- a/dev-packages/rollup-utils/plugins/bundlePlugins.mjs +++ b/dev-packages/rollup-utils/plugins/bundlePlugins.mjs @@ -1,73 +1,51 @@ -/** - * 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 - */ - 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. * * @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 + * @returns An instance of the `rolldown.replacePlugin` plugin to do the replacement of the magic string with `true` or * 'false` */ export function makeIsDebugBuildPlugin(includeDebugging) { - return 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), + }, + { + // 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, }, - }); + ); } export function makeSetSDKSourcePlugin(sdkSource) { - return replace({ - preventAssignment: false, - delimiters: ['', ''], - values: { - '/* __SENTRY_SDK_SOURCE__ */': `return ${JSON.stringify(sdkSource)};`, + return replacePlugin( + { + '/*! __SENTRY_SDK_SOURCE__ */': `return ${JSON.stringify(sdkSource)};`, }, - }); + { + preventAssignment: false, + delimiters: ['', ''], + }, + ); } /** @@ -77,81 +55,72 @@ export function makeSetSDKSourcePlugin(sdkSource) { * @returns An instance of the `replace` plugin to do the replacement of the magic string with `true` or 'false` */ export function makeBrowserBuildPlugin(isBrowserBuild) { - return 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), + // Replace process.env.NODE_ENV for browser bundles (needed for dependencies like Preact) + 'process.env.NODE_ENV': JSON.stringify('production'), + }, + { + preventAssignment: true, }, - }); + ); } -// `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`. + * Create minifier options for the rollup build. * - * @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', - // This is used in metadata integration - '_sentryModuleMetadata', - ], - }, - }, - output: { - comments: false, - }, - }); -} +export function makeMinifierOptions() { + // FIXME: mangle properties options are not supported by rolldown yet, so we return true for now. + // We should remove this once rolldown supports these options. + // Keeping the original options for reference in case we want to add them back. + // For now, rolldown won't mangle properties, so it should be safe. + // https://github.com/oxc-project/oxc/issues/15375 + // `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', + // // This is used in metadata integration + // '_sentryModuleMetadata', + // ], + // }, -// 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(); + return true; } - -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 7f08873f1c80..dfe40039b115 100644 --- a/dev-packages/rollup-utils/plugins/npmPlugins.mjs +++ b/dev-packages/rollup-utils/plugins/npmPlugins.mjs @@ -1,46 +1,8 @@ /** - * Rollup plugin hooks docs: https://rollupjs.org/guide/en/#build-hooks and - * https://rollupjs.org/guide/en/#output-generation-hooks - * - * Cleanup plugin docs: https://github.com/aMarCruz/rollup-plugin-cleanup - * Replace plugin docs: https://github.com/rollup/plugins/tree/master/packages/replace - * Sucrase plugin docs: https://github.com/rollup/plugins/tree/master/packages/sucrase + * Replace plugin docs: https://rolldown.rs/builtin-plugins/replace#replace-plugin */ -import * as fs from 'fs'; -import * as path from 'path'; - -import json from '@rollup/plugin-json'; -import replace from '@rollup/plugin-replace'; -import cleanup from 'rollup-plugin-cleanup'; -import sucrase from './vendor/sucrase-plugin.mjs'; - -/** - * Create a plugin to transpile TS syntax using `sucrase`. - * - * @returns An instance of the `@rollup/plugin-sucrase` plugin - */ -export function makeSucrasePlugin(options = {}, sucraseOptions = {}) { - return sucrase( - { - // Required for bundling OTEL code properly - exclude: ['**/*.json'], - ...options, - }, - { - transforms: ['typescript', 'jsx'], - // We use a custom forked version of sucrase, - // where there is a new option `disableES2019Transforms` - disableESTransforms: false, - disableES2019Transforms: true, - ...sucraseOptions, - }, - ); -} - -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. @@ -92,46 +54,38 @@ export function makeDebuggerPlugin(hookName) { }; } -/** - * Create a plugin to clean up output files by: - * - Converting line endings unix line endings - * - Removing consecutive empty lines - * - * @returns A `rollup-plugin-cleanup` instance. - */ -export function makeCleanupPlugin() { - return cleanup({ - // line endings are unix-ized by default - comments: 'all', // comments to keep - compactComments: 'false', // don't remove blank lines in multi-line comments - maxEmptyLines: 1, - extensions: ['js', 'jsx', 'ts', 'tsx'], - }); -} - /** * Creates a plugin to replace all instances of "__DEBUG_BUILD__" with a safe statement that * 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.replacePlugin` instance. */ export function makeDebugBuildStatementReplacePlugin() { - return replace({ - preventAssignment: false, - values: { + return replacePlugin( + { __DEBUG_BUILD__: "(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)", }, - }); + { + preventAssignment: true, + }, + ); } export function makeProductionReplacePlugin() { - const pattern = /\/\* rollup-include-development-only \*\/[\s\S]*?\/\* rollup-include-development-only-end \*\/\s*/g; + // Use legal comments (/*!) so they're preserved by Rolldown + // NOTE: Due to a Rolldown limitation, the ending comment must be placed before a statement + // (e.g., before a return) rather than after a block, otherwise it gets stripped. + // See: https://github.com/rolldown/rolldown/issues/[TODO: file issue] + const pattern = + /\/\*! rollup-include-development-only \*\/[\s\S]*?\/\*! rollup-include-development-only-end \*\/\s*/g; function stripDevBlocks(code) { if (!code) return null; if (!code.includes('rollup-include-development-only')) return null; + const replaced = code.replace(pattern, ''); + return { code: replaced, map: null }; } @@ -162,23 +116,7 @@ export function makeRrwebBuildPlugin({ excludeShadowDom, excludeIframe } = {}) { values['__RRWEB_EXCLUDE_IFRAME__'] = excludeIframe; } - return replace({ + return replacePlugin(values, { preventAssignment: true, - values, - }); -} - -/** - * Plugin that uploads bundle analysis to codecov. - * - * @param type The type of bundle being uploaded. - * @param prefix The prefix for the codecov bundle name. Defaults to 'npm'. - */ -export function makeCodeCovPlugin() { - const packageJson = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' })); - return codecovRollupPlugin({ - enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined, - bundleName: packageJson.name, - uploadToken: process.env.CODECOV_TOKEN, }); } diff --git a/dev-packages/rollup-utils/plugins/vendor/sucrase-plugin.mjs b/dev-packages/rollup-utils/plugins/vendor/sucrase-plugin.mjs deleted file mode 100644 index 63465e768bc9..000000000000 --- a/dev-packages/rollup-utils/plugins/vendor/sucrase-plugin.mjs +++ /dev/null @@ -1,79 +0,0 @@ -// Vendored from https://github.com/rollup/plugins/blob/0090e728f52828d39b071ab5c7925b9b575cd568/packages/sucrase/src/index.js and modified - -/* - -The MIT License (MIT) - -Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -import fs from 'fs'; -import path from 'path'; - -import { createFilter } from '@rollup/pluginutils'; -import { transform } from 'sucrase'; - -export default function sucrase(opts = {}, sucraseOpts = {}) { - const filter = createFilter(opts.include, opts.exclude); - - return { - name: 'sucrase', - - // eslint-disable-next-line consistent-return - resolveId(importee, importer) { - if (importer && /^[./]/.test(importee)) { - const resolved = path.resolve(importer ? path.dirname(importer) : process.cwd(), importee); - // resolve in the same order that TypeScript resolves modules - const resolvedFilenames = [ - `${resolved}.ts`, - `${resolved}.tsx`, - `${resolved}/index.ts`, - `${resolved}/index.tsx`, - ]; - if (resolved.endsWith('.js')) { - resolvedFilenames.splice(2, 0, `${resolved.slice(0, -3)}.ts`, `${resolved.slice(0, -3)}.tsx`); - } - const resolvedFilename = resolvedFilenames.find(filename => fs.existsSync(filename)); - - if (resolvedFilename) { - return resolvedFilename; - } - } - }, - - transform(code, id) { - if (!filter(id)) return null; - const result = transform(code, { - transforms: sucraseOpts.transforms, - filePath: id, - sourceMapOptions: { - compiledFilename: id, - }, - ...sucraseOpts, - }); - return { - code: result.code, - map: result.sourceMap, - }; - }, - }; -} diff --git a/dev-packages/rollup-utils/utils.mjs b/dev-packages/rollup-utils/utils.mjs index b687ff9993c4..4dec0fc3e346 100644 --- a/dev-packages/rollup-utils/utils.mjs +++ b/dev-packages/rollup-utils/utils.mjs @@ -21,16 +21,7 @@ export function mergePlugins(pluginsA, pluginsB) { // here. // Additionally, the excludeReplay plugin must run before TS/Sucrase so that we can eliminate the replay code // before anything is type-checked (TS-only) and transpiled. - const order = [ - 'remove-dev-mode-blocks', - 'excludeReplay', - 'typescript', - 'sucrase', - '...', - 'terser', - 'license', - 'output-base64-worker-script', - ]; + const order = ['remove-dev-mode-blocks', 'excludeReplay', '...', 'output-base64-worker-script']; const sortKeyA = order.includes(a.name) ? a.name : '...'; const sortKeyB = order.includes(b.name) ? b.name : '...'; @@ -39,3 +30,22 @@ export function mergePlugins(pluginsA, pluginsB) { return plugins; } + +/** + * Creates a treeshake setting preset, rolldown doesn't have "smallest" as a preset, so we need to create our own. + * Smallest + * https://rolldown.rs/options/treeshake#treeshake + * https://rollupjs.org/configuration-options/#treeshake + * @param {boolean | readonly string[] | ModuleSideEffectsRule[] | ((id: string, external: boolean) => boolean | undefined) | 'no-external' | 'smallest'} preset - The preset to use + */ +export function treeShakePreset(preset) { + if (preset === 'smallest') { + return { + propertyReadSideEffects: false, + moduleSideEffects: false, + unknownGlobalSideEffects: false, + }; + } + + return preset; +} diff --git a/dev-packages/test-utils/package.json b/dev-packages/test-utils/package.json index be79abd0c813..f3dfbc78eea2 100644 --- a/dev-packages/test-utils/package.json +++ b/dev-packages/test-utils/package.json @@ -36,7 +36,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 b0f32aa93a50..7528c23cea64 100644 --- a/package.json +++ b/package.json @@ -104,15 +104,6 @@ "dev-packages/bundler-tests" ], "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.7", - "@rollup/plugin-esm-shim": "^0.1.5", - "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^15.2.3", - "@rollup/plugin-replace": "^5.0.5", - "@rollup/plugin-sucrase": "^5.0.2", - "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^11.1.6", - "@rollup/pluginutils": "^5.1.0", "@size-limit/file": "~11.1.6", "@size-limit/webpack": "~11.1.6", "@types/jsdom": "^21.1.6", @@ -130,11 +121,8 @@ "prettier": "^3.6.2", "prettier-plugin-astro": "^0.14.1", "rimraf": "^5.0.10", - "rollup": "^4.35.0", - "rollup-plugin-cleanup": "^3.2.1", - "rollup-plugin-license": "^3.3.1", + "rolldown": "^1.0.0-beta.53", "size-limit": "~11.1.6", - "sucrase": "^3.35.0", "ts-node": "10.9.1", "typescript": "~5.8.0", "vitest": "^3.2.4", @@ -149,8 +137,7 @@ "resolutions": { "gauge/strip-ansi": "6.0.1", "wide-align/string-width": "4.2.3", - "cliui/wrap-ansi": "7.0.0", - "sucrase": "getsentry/sucrase#es2020-polyfills" + "cliui/wrap-ansi": "7.0.0" }, "version": "0.0.0", "name": "sentry-javascript", diff --git a/packages/astro/package.json b/packages/astro/package.json index 8277bf8b152e..2cc47d5d50ab 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -68,11 +68,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: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", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", diff --git a/packages/aws-serverless/package.json b/packages/aws-serverless/package.json index 7db027739f54..f897262e65c8 100644 --- a/packages/aws-serverless/package.json +++ b/packages/aws-serverless/package.json @@ -80,15 +80,15 @@ }, "scripts": { "build": "run-p build:transpile build:types", - "build:layer": "rimraf build/aws && rollup -c rollup.lambda-extension.config.mjs && yarn ts-node scripts/buildLambdaLayer.ts", + "build:layer": "rimraf build/aws && rolldown -c rollup.lambda-extension.config.mjs && yarn ts-node scripts/buildLambdaLayer.ts", "build:dev": "run-p build:transpile build:types", - "build:transpile": "rollup -c rollup.npm.config.mjs && yarn build:layer", + "build:transpile": "rolldown -c rollup.npm.config.mjs && yarn build:layer", "build:types": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/npm/types build/npm/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/aws-serverless/scripts/buildLambdaLayer.ts b/packages/aws-serverless/scripts/buildLambdaLayer.ts index 241bc864816a..7bf441e66b44 100644 --- a/packages/aws-serverless/scripts/buildLambdaLayer.ts +++ b/packages/aws-serverless/scripts/buildLambdaLayer.ts @@ -207,8 +207,8 @@ function replaceSDKSource(): void { // Replace the line marked with __SENTRY_SDK_SOURCE__ comment // Change from 'npm' to 'aws-lambda-layer' to identify that this is the AWS Lambda layer content = content.replace( - "/* __SENTRY_SDK_SOURCE__ */ return 'npm';", - "/* __SENTRY_SDK_SOURCE__ */ return 'aws-lambda-layer';", + '/*! __SENTRY_SDK_SOURCE__ */ return "npm";', + '/*! __SENTRY_SDK_SOURCE__ */ return "aws-lambda-layer";', ); fs.writeFileSync(envFile, content); diff --git a/packages/browser-utils/package.json b/packages/browser-utils/package.json index 33ebffad4189..f2ad99b4faac 100644 --- a/packages/browser-utils/package.json +++ b/packages/browser-utils/package.json @@ -44,13 +44,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "build:watch": "run-p build:transpile:watch build:types:watch", "build:dev:watch": "run-p build:transpile:watch build:types: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-internal-browser-utils-*.tgz", diff --git a/packages/browser/package.json b/packages/browser/package.json index 971b114fbc33..e85e8f20a252 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -57,15 +57,15 @@ "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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/npm/types build/npm/types-ts3.8 --to ts3.8", "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": "rollup -c rollup.bundle.config.mjs --watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --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", diff --git a/packages/browser/src/sdk.ts b/packages/browser/src/sdk.ts index 800c1b701352..f6df23564aa6 100644 --- a/packages/browser/src/sdk.ts +++ b/packages/browser/src/sdk.ts @@ -94,7 +94,7 @@ export function init(options: BrowserOptions = {}): Client | undefined { let defaultIntegrations = options.defaultIntegrations == null ? getDefaultIntegrations(options) : options.defaultIntegrations; - /* rollup-include-development-only */ + /*! rollup-include-development-only */ if (options.spotlight) { if (!defaultIntegrations) { defaultIntegrations = []; @@ -102,7 +102,6 @@ export function init(options: BrowserOptions = {}): Client | undefined { const args = typeof options.spotlight === 'string' ? { sidecarUrl: options.spotlight } : undefined; defaultIntegrations.push(spotlightBrowserIntegration(args)); } - /* rollup-include-development-only-end */ const clientOptions: BrowserClientOptions = { ...options, @@ -114,6 +113,9 @@ export function init(options: BrowserOptions = {}): Client | undefined { }), transport: options.transport || makeFetchTransport, }; + // TODO: This is here to avoid the Rolldown limitation of not being able to place the ending comment after a block + // Should be moved back after the if block once the Rolldown limitation is fixed + /*! rollup-include-development-only-end */ return initAndBind(BrowserClient, clientOptions); } diff --git a/packages/bun/package.json b/packages/bun/package.json index f64447757df1..8a41952f251c 100644 --- a/packages/bun/package.json +++ b/packages/bun/package.json @@ -48,13 +48,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/cloudflare/package.json b/packages/cloudflare/package.json index 84dcdf3dd8c8..683341f808f4 100644 --- a/packages/cloudflare/package.json +++ b/packages/cloudflare/package.json @@ -68,13 +68,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/core/package.json b/packages/core/package.json index 669a70e5e8ba..998beaf6cf2c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -41,13 +41,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/core/rollup.npm.config.mjs b/packages/core/rollup.npm.config.mjs index cc3ad4064820..c6c96c546930 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')); @@ -27,12 +27,14 @@ export default makeNPMConfigVariants( : Boolean(process.env.SENTRY_BUILD_PRESERVE_MODULES), }, plugins: [ - replace({ - preventAssignment: true, - values: { + replacePlugin( + { __SENTRY_SDK_VERSION__: JSON.stringify(packageVersion), }, - }), + { + preventAssignment: true, + }, + ), ], }, }), diff --git a/packages/core/src/utils/env.ts b/packages/core/src/utils/env.ts index 86872017707a..5fdd9e9b7b91 100644 --- a/packages/core/src/utils/env.ts +++ b/packages/core/src/utils/env.ts @@ -31,5 +31,5 @@ export function isBrowserBundle(): boolean { */ export function getSDKSource(): SdkSource { // This comment is used to identify this line in the CDN bundle build step and replace this with "return 'cdn';" - /* __SENTRY_SDK_SOURCE__ */ return 'npm'; + /*! __SENTRY_SDK_SOURCE__ */ return 'npm'; } diff --git a/packages/deno/package.json b/packages/deno/package.json index a3c03eec89d8..cbb3e64f1b0b 100644 --- a/packages/deno/package.json +++ b/packages/deno/package.json @@ -31,7 +31,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/eslint-config-sdk/src/base.js b/packages/eslint-config-sdk/src/base.js index 5b77056bfbb2..238bf2ed14ed 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 b016c325ed71..2464624eb842 100644 --- a/packages/feedback/package.json +++ b/packages/feedback/package.json @@ -46,8 +46,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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", diff --git a/packages/feedback/rollup.bundle.config.mjs b/packages/feedback/rollup.bundle.config.mjs index a5efc6140c06..c5f98bd09b28 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,13 +20,7 @@ export default [ jsVersion: 'es6', licenseTitle: '@sentry-internal/feedback', outputFileBase: () => 'bundles/feedback-screenshot', - sucrase: { - // The feedback widget is using preact so we need different pragmas and jsx runtimes - jsxPragma: 'h', - jsxFragmentPragma: 'Fragment', - jsxRuntime: 'classic', - production: true, - }, + packageSpecificConfig: preactAlias, }), ), ...makeBundleConfigVariants( @@ -26,13 +30,7 @@ export default [ jsVersion: 'es6', licenseTitle: '@sentry-internal/feedback', outputFileBase: () => 'bundles/feedback-modal', - sucrase: { - // The feedback widget is using preact so we need different pragmas and jsx runtimes - jsxPragma: 'h', - jsxFragmentPragma: 'Fragment', - jsxRuntime: 'classic', - production: true, - }, + packageSpecificConfig: preactAlias, }), ), ]; diff --git a/packages/feedback/rollup.npm.config.mjs b/packages/feedback/rollup.npm.config.mjs index c91c37ec84f8..f012e515a5e0 100644 --- a/packages/feedback/rollup.npm.config.mjs +++ b/packages/feedback/rollup.npm.config.mjs @@ -15,12 +15,5 @@ export default makeNPMConfigVariants( : Boolean(process.env.SENTRY_BUILD_PRESERVE_MODULES), }, }, - sucrase: { - // The feedback widget is using preact so we need different pragmas and jsx runtimes - jsxPragma: 'h', - jsxFragmentPragma: 'Fragment', - jsxRuntime: 'classic', - production: true, - }, }), ); diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index 523ef04f127a..290a5dfe55ad 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -64,13 +64,13 @@ "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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/google-cloud-serverless/package.json b/packages/google-cloud-serverless/package.json index 64761da8d428..328b9aa21313 100644 --- a/packages/google-cloud-serverless/package.json +++ b/packages/google-cloud-serverless/package.json @@ -61,13 +61,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/integration-shims/package.json b/packages/integration-shims/package.json index 0411d93e0d76..e9a80ee97a54 100644 --- a/packages/integration-shims/package.json +++ b/packages/integration-shims/package.json @@ -32,7 +32,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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", diff --git a/packages/nestjs/package.json b/packages/nestjs/package.json index 3468a1a0e21e..976c0a377477 100644 --- a/packages/nestjs/package.json +++ b/packages/nestjs/package.json @@ -65,13 +65,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: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: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", "circularDepCheck": "madge --circular src/index.ts && madge --circular src/setup.ts", diff --git a/packages/nextjs/rollup.npm.config.mjs b/packages/nextjs/rollup.npm.config.mjs index 89271a21e9d3..46d47582ab1e 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/loaders', // 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/polyfills', // make it so Rollup calms down about the fact that we're combining default and named exports exports: 'named', @@ -94,8 +123,7 @@ export default [ packageSpecificConfig: { output: { - // Preserve the original file structure (i.e., so that everything is still relative to `src`) - entryFileNames: 'config/polyfills/[name].js', + virtualDirname: '_virtual/polyfills', // 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 d273146b872d..78010a4932b7 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/nextjs/test/config/wrappingLoader.test.ts b/packages/nextjs/test/config/wrappingLoader.test.ts index ab33450790bb..0e96ebf1faab 100644 --- a/packages/nextjs/test/config/wrappingLoader.test.ts +++ b/packages/nextjs/test/config/wrappingLoader.test.ts @@ -100,7 +100,8 @@ describe('wrappingLoader', () => { await loaderPromise; - expect(callback).toHaveBeenCalledWith(null, expect.stringContaining("'/my/route'"), expect.anything()); + // Rolldown uses double quotes, old Rollup used single quotes + expect(callback).toHaveBeenCalledWith(null, expect.stringMatching(/["']\/my\/route['"]/), expect.anything()); }); describe('middleware wrapping', () => { @@ -148,8 +149,8 @@ describe('wrappingLoader', () => { expect(wrappedCode).toContain('userProvidedProxy = true'); // Proxy should be wrapped, middleware should be undefined - expect(wrappedCode).toMatch(/const proxy = userProvidedProxy \? wrappedHandler : undefined/); - expect(wrappedCode).toMatch(/const middleware = userProvidedMiddleware \? wrappedHandler : undefined/); + expect(wrappedCode).toMatch(/const proxy = userProvidedProxy \? wrappedHandler : (?:undefined|void 0)/); + expect(wrappedCode).toMatch(/const middleware = userProvidedMiddleware \? wrappedHandler : (?:undefined|void 0)/); }); it('should export middleware when user exports named "middleware" export', async () => { @@ -196,8 +197,8 @@ describe('wrappingLoader', () => { expect(wrappedCode).toContain('userProvidedProxy = false'); // Middleware should be wrapped, proxy should be undefined - expect(wrappedCode).toMatch(/const middleware = userProvidedMiddleware \? wrappedHandler : undefined/); - expect(wrappedCode).toMatch(/const proxy = userProvidedProxy \? wrappedHandler : undefined/); + expect(wrappedCode).toMatch(/const middleware = userProvidedMiddleware \? wrappedHandler : (?:undefined|void 0)/); + expect(wrappedCode).toMatch(/const proxy = userProvidedProxy \? wrappedHandler : (?:undefined|void 0)/); }); it('should export undefined middleware/proxy when user only exports default', async () => { @@ -245,8 +246,8 @@ describe('wrappingLoader', () => { expect(wrappedCode).toContain('userProvidedProxy = false'); // Both middleware and proxy should be undefined (conditionals evaluate to false) - expect(wrappedCode).toMatch(/const middleware = userProvidedMiddleware \? wrappedHandler : undefined/); - expect(wrappedCode).toMatch(/const proxy = userProvidedProxy \? wrappedHandler : undefined/); + expect(wrappedCode).toMatch(/const middleware = userProvidedMiddleware \? wrappedHandler : (?:undefined|void 0)/); + expect(wrappedCode).toMatch(/const proxy = userProvidedProxy \? wrappedHandler : (?:undefined|void 0)/); }); }); }); diff --git a/packages/node-core/package.json b/packages/node-core/package.json index d2de42c4d42b..737908d4ca25 100644 --- a/packages/node-core/package.json +++ b/packages/node-core/package.json @@ -85,13 +85,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/node-core/rollup.npm.config.mjs b/packages/node-core/rollup.npm.config.mjs index 8e18333836ef..2e3d0671f02d 100644 --- a/packages/node-core/rollup.npm.config.mjs +++ b/packages/node-core/rollup.npm.config.mjs @@ -1,4 +1,3 @@ -import replace from '@rollup/plugin-replace'; import { makeBaseNPMConfig, makeNPMConfigVariants, makeOtelLoaders } from '@sentry-internal/rollup-utils'; import { createWorkerCodeBuilder } from './rollup.anr-worker.config.mjs'; @@ -12,6 +11,36 @@ const [localVariablesWorkerConfig, getLocalVariablesBase64Code] = createWorkerCo 'build/esm/integrations/local-variables', ); +/** + * Custom replace plugin that lazily evaluates replacement values. + * This is needed because the worker scripts are built in earlier configs, + * and we need to wait for their renderChunk hooks to complete before + * we can get the base64-encoded worker code. + */ +function makeLazyReplacePlugin(replacements, options = {}) { + const { delimiters = ['###', '###'] } = options; + const [delimiterStart, delimiterEnd] = delimiters; + + return { + name: 'lazy-replace-plugin', + renderChunk(code) { + let result = code; + + for (const [key, valueFn] of Object.entries(replacements)) { + const value = typeof valueFn === 'function' ? valueFn() : valueFn; + const searchPattern = `${delimiterStart}${key}${delimiterEnd}`; + // Don't add quotes - the source already has quotes around the placeholder + const replacement = value; + + // Replace all occurrences + result = result.split(searchPattern).join(replacement); + } + + return { code: result }; + }, + }; +} + export default [ ...makeOtelLoaders('./build', 'otel'), // The workers needs to be built first since it's their output is copied in the main bundle. @@ -27,15 +56,15 @@ 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-native/package.json b/packages/node-native/package.json index f5f2ef232c4b..baf464da91da 100644 --- a/packages/node-native/package.json +++ b/packages/node-native/package.json @@ -53,12 +53,12 @@ "lint:es-compatibility": "es-check es2022 ./build/cjs/*.js && es-check es2022 ./build/esm/*.js --module", "fix": "eslint . --format stylish --fix", "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:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "build:types": "tsc -p tsconfig.types.json && yarn build:types:downlevel", "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:dev": "yarn clean && yarn build", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", "build:watch": "run-p build:transpile:watch build:types:watch", "build:tarball": "npm pack" }, diff --git a/packages/node/package.json b/packages/node/package.json index 867124cb6318..8118203b7db0 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -107,13 +107,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index ea4cc88bc3a3..a389e14432fc 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -67,11 +67,11 @@ "build": "run-s build:types build:transpile", "build:dev": "yarn build", "build:nuxt-module": "bash ./generate-build-stubs.bash && nuxt-module-build build --outDir build/module", - "build:transpile": "rollup -c rollup.npm.config.mjs && yarn build:nuxt-module", + "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: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", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", diff --git a/packages/opentelemetry/package.json b/packages/opentelemetry/package.json index e218c87033e1..4703c0c877b5 100644 --- a/packages/opentelemetry/package.json +++ b/packages/opentelemetry/package.json @@ -58,13 +58,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/profiling-node/package.json b/packages/profiling-node/package.json index 258b043cb2e6..676acda6e12d 100644 --- a/packages/profiling-node/package.json +++ b/packages/profiling-node/package.json @@ -49,12 +49,12 @@ "lint:es-compatibility": "es-check es2022 ./build/cjs/*.js && es-check es2022 ./build/esm/*.js --module", "fix": "eslint . --format stylish --fix", "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:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "build:types": "tsc -p tsconfig.types.json && yarn build:types:downlevel", "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:dev": "yarn clean && yarn build", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:transpile:watch": "rolldown -c rollup.npm.config.mjs --watch", "build:watch": "run-p build:transpile:watch build:types:watch", "build:tarball": "npm pack", "test:bundle": "node test-binaries.esbuild.js", diff --git a/packages/react-router/package.json b/packages/react-router/package.json index 10aab7897e3e..ce5570e7d713 100644 --- a/packages/react-router/package.json +++ b/packages/react-router/package.json @@ -72,12 +72,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", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", diff --git a/packages/react-router/rollup.npm.config.mjs b/packages/react-router/rollup.npm.config.mjs index 4a52f4ab57a7..d4edb3b23c9b 100644 --- a/packages/react-router/rollup.npm.config.mjs +++ b/packages/react-router/rollup.npm.config.mjs @@ -11,12 +11,6 @@ export default [ exports: 'named', }, }, - sucrase: { - // React 19 emits a warning if we don't use the newer jsx transform: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html - // but this breaks react 17, so we keep it at `classic` for now - jsxRuntime: 'classic', - production: true, // This is needed so that sucrase uses the production jsx runtime (ie `import { jsx } from 'react/jsx-runtime'` instead of `import { jsxDEV as _jsxDEV } from 'react/jsx-dev-runtime'`) - }, }), ), ]; diff --git a/packages/react/package.json b/packages/react/package.json index fd650fe0b87c..84d6f4be0789 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -70,13 +70,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/react/rollup.npm.config.mjs b/packages/react/rollup.npm.config.mjs index 923dfafb85d7..edfc16d8d2ff 100644 --- a/packages/react/rollup.npm.config.mjs +++ b/packages/react/rollup.npm.config.mjs @@ -5,11 +5,5 @@ export default makeNPMConfigVariants( packageSpecificConfig: { external: ['react', 'react/jsx-runtime'], }, - sucrase: { - // React 19 emits a warning if we don't use the newer jsx transform: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html - // but this breaks react 17, so we keep it at `classic` for now - jsxRuntime: 'classic', - production: true, // This is needed so that sucrase uses the production jsx runtime (ie `import { jsx } from 'react/jsx-runtime'` instead of `import { jsxDEV as _jsxDEV } from 'react/jsx-dev-runtime'`) - }, }), ); diff --git a/packages/remix/package.json b/packages/remix/package.json index 615d64f87383..509dbac65c3d 100644 --- a/packages/remix/package.json +++ b/packages/remix/package.json @@ -29,7 +29,11 @@ "require": "./build/cjs/index.client.js", "default": "./build/cjs/index.client.js" }, - "node": "./build/cjs/index.server.js", + "node": { + "import": "./build/esm/index.server.js", + "require": "./build/cjs/index.server.js", + "default": "./build/cjs/index.server.js" + }, "worker": { "import": "./build/esm/cloudflare/index.js", "require": "./build/cjs/cloudflare/index.js", @@ -37,9 +41,9 @@ } }, "./cloudflare": { + "types": "./build/types/cloudflare/index.d.ts", "import": "./build/esm/cloudflare/index.js", "require": "./build/cjs/cloudflare/index.js", - "types": "./build/types/cloudflare/index.d.ts", "default": "./build/esm/cloudflare/index.js" }, "./import": { @@ -93,13 +97,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.server.ts && madge --circular src/index.client.ts", diff --git a/packages/remix/rollup.npm.config.mjs b/packages/remix/rollup.npm.config.mjs index 8ba7eac8051b..bd26bd1b06c2 100644 --- a/packages/remix/rollup.npm.config.mjs +++ b/packages/remix/rollup.npm.config.mjs @@ -17,12 +17,6 @@ export default [ exports: 'named', }, }, - sucrase: { - // React 19 emits a warning if we don't use the newer jsx transform: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html - // but this breaks react 17, so we keep it at `classic` for now - jsxRuntime: 'classic', - production: true, // This is needed so that sucrase uses the production jsx runtime (ie `import { jsx } from 'react/jsx-runtime'` instead of `import { jsxDEV as _jsxDEV } from 'react/jsx-dev-runtime'`) - }, }), ), ...makeOtelLoaders('./build', 'sentry-node'), diff --git a/packages/remix/src/server/instrumentServer.ts b/packages/remix/src/server/instrumentServer.ts index 273f72d809c1..9da88157f1bf 100644 --- a/packages/remix/src/server/instrumentServer.ts +++ b/packages/remix/src/server/instrumentServer.ts @@ -24,7 +24,6 @@ import { hasSpansEnabled, httpHeadersToSpanAttributes, isNodeEnv, - loadModule, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -397,7 +396,8 @@ function instrumentBuildCallback( // We should be able to wrap them, as they may not be wrapped before. const defaultExport = wrappedEntry.module.default as undefined | WrappedFunction; if (defaultExport && !defaultExport.__sentry_original__) { - fill(wrappedEntry.module, 'default', makeWrappedDocumentRequestFunction(options?.instrumentTracing)); + const instrumentTracing = options ? options.instrumentTracing : undefined; + fill(wrappedEntry.module, 'default', makeWrappedDocumentRequestFunction(instrumentTracing)); } for (const [id, route] of Object.entries(build.routes)) { @@ -411,18 +411,21 @@ function instrumentBuildCallback( } if (!(wrappedRoute.module.loader as WrappedFunction).__sentry_original__) { - fill(wrappedRoute.module, 'loader', makeWrappedRootLoader(options?.instrumentTracing, build)); + const instrumentTracing = options ? options.instrumentTracing : undefined; + fill(wrappedRoute.module, 'loader', makeWrappedRootLoader(instrumentTracing, build)); } } const routeAction = wrappedRoute.module.action as undefined | WrappedFunction; if (routeAction && !routeAction.__sentry_original__) { - fill(wrappedRoute.module, 'action', makeWrappedAction(id, options?.instrumentTracing, build)); + const instrumentTracing = options ? options.instrumentTracing : undefined; + fill(wrappedRoute.module, 'action', makeWrappedAction(id, instrumentTracing, build)); } const routeLoader = wrappedRoute.module.loader as undefined | WrappedFunction; if (routeLoader && !routeLoader.__sentry_original__) { - fill(wrappedRoute.module, 'loader', makeWrappedLoader(id, options?.instrumentTracing, build)); + const instrumentTracing = options ? options.instrumentTracing : undefined; + fill(wrappedRoute.module, 'loader', makeWrappedLoader(id, instrumentTracing, build)); } routes[id] = wrappedRoute; @@ -472,21 +475,3 @@ export const makeWrappedCreateRequestHandler = (options?: { instrumentTracing?: return wrapRequestHandler(requestHandler, newBuild, options); }; }; - -/** - * Monkey-patch Remix's `createRequestHandler` from `@remix-run/server-runtime` - * which Remix Adapters (https://remix.run/docs/en/v1/api/remix) use underneath. - */ -export function instrumentServer(options?: { instrumentTracing?: boolean }): void { - const pkg = loadModule<{ - createRequestHandler: CreateRequestHandlerFunction; - }>('@remix-run/server-runtime', module); - - if (!pkg) { - DEBUG_BUILD && debug.warn('Remix SDK was unable to require `@remix-run/server-runtime` package.'); - - return; - } - - fill(pkg, 'createRequestHandler', makeWrappedCreateRequestHandler(options)); -} diff --git a/packages/remix/src/server/patchServerRuntime.ts b/packages/remix/src/server/patchServerRuntime.ts new file mode 100644 index 000000000000..c0c3370043c8 --- /dev/null +++ b/packages/remix/src/server/patchServerRuntime.ts @@ -0,0 +1,46 @@ +import type { CreateRequestHandlerFunction } from '@remix-run/server-runtime'; +import { debug, fill, loadModule } from '@sentry/core'; +import { createRequire } from 'module'; +import { DEBUG_BUILD } from '../utils/debug-build'; +import { makeWrappedCreateRequestHandler } from './instrumentServer'; + +/** + * Helper to load a module in both CJS and ESM contexts. + * In ESM, we use createRequire to create a require function. + * In CJS, we use the standard loadModule. + */ +function loadModuleCompat(moduleName: string): T | undefined { + // Check if we're in ESM context (module doesn't exist) + if (typeof module === 'undefined') { + // ESM context - use createRequire to get a require function + try { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const require = createRequire(import.meta.url); + return require(moduleName) as T; + } catch { + return undefined; + } + } else { + // CJS context - use loadModule with module reference + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return loadModule(moduleName, module as any); + } +} + +/** + * Monkey-patch Remix's `createRequestHandler` from `@remix-run/server-runtime` + * which Remix Adapters (https://remix.run/docs/en/v1/api/remix) use underneath. + */ +export function instrumentServer(options?: { instrumentTracing?: boolean }): void { + const pkg = loadModuleCompat<{ + createRequestHandler: CreateRequestHandlerFunction; + }>('@remix-run/server-runtime'); + + if (!pkg) { + DEBUG_BUILD && debug.warn('Remix SDK was unable to require `@remix-run/server-runtime` package.'); + + return; + } + + fill(pkg, 'createRequestHandler', makeWrappedCreateRequestHandler(options)); +} diff --git a/packages/remix/src/server/sdk.ts b/packages/remix/src/server/sdk.ts index f191a336cfbb..1a8e41a3eecc 100644 --- a/packages/remix/src/server/sdk.ts +++ b/packages/remix/src/server/sdk.ts @@ -4,9 +4,9 @@ import type { NodeClient, NodeOptions } from '@sentry/node'; import { getDefaultIntegrations as getDefaultNodeIntegrations, init as nodeInit, isInitialized } from '@sentry/node'; import { DEBUG_BUILD } from '../utils/debug-build'; import type { RemixOptions } from '../utils/remixOptions'; -import { instrumentServer } from './instrumentServer'; import { httpIntegration } from './integrations/http'; import { remixIntegration } from './integrations/opentelemetry'; +import { instrumentServer } from './patchServerRuntime'; /** * Returns the default Remix integrations. diff --git a/packages/remix/test/config/vite.test.ts b/packages/remix/test/config/vite.test.ts index 2f3ccc5464ca..d85f995924d0 100644 --- a/packages/remix/test/config/vite.test.ts +++ b/packages/remix/test/config/vite.test.ts @@ -62,9 +62,7 @@ describe('sentryRemixVitePlugin', () => { fs.writeFileSync(path.join(routesDir, 'about.tsx'), '// about'); fs.writeFileSync(path.join(routesDir, 'users.$id.tsx'), '// users'); - const plugin = sentryRemixVitePlugin() as Plugin & { - configResolved: (config: ResolvedConfig) => void; - }; + const plugin = sentryRemixVitePlugin(); const mockConfig: Partial = { root: tempDir, @@ -83,9 +81,7 @@ describe('sentryRemixVitePlugin', () => { fs.writeFileSync(path.join(routesDir, 'index.tsx'), '// index'); fs.writeFileSync(path.join(routesDir, 'users.$id.tsx'), '// users'); - const plugin = sentryRemixVitePlugin() as Plugin & { - configResolved: (config: ResolvedConfig) => void; - }; + const plugin = sentryRemixVitePlugin(); const mockConfig: Partial = { root: tempDir, @@ -101,9 +97,7 @@ describe('sentryRemixVitePlugin', () => { }); it('should handle errors gracefully and set empty manifest', () => { - const plugin = sentryRemixVitePlugin({ appDirPath: '/nonexistent/path' }) as Plugin & { - configResolved: (config: ResolvedConfig) => void; - }; + const plugin = sentryRemixVitePlugin({ appDirPath: '/nonexistent/path' }); const mockConfig: Partial = { root: tempDir, @@ -124,9 +118,7 @@ describe('sentryRemixVitePlugin', () => { fs.mkdirSync(customRoutesDir, { recursive: true }); fs.writeFileSync(path.join(customRoutesDir, 'index.tsx'), '// index'); - const plugin = sentryRemixVitePlugin({ appDirPath: customAppDir }) as Plugin & { - configResolved: (config: ResolvedConfig) => void; - }; + const plugin = sentryRemixVitePlugin({ appDirPath: customAppDir }); const mockConfig: Partial = { root: tempDir, @@ -144,13 +136,7 @@ describe('sentryRemixVitePlugin', () => { it('should inject manifest into HTML with tag', () => { fs.writeFileSync(path.join(routesDir, 'index.tsx'), '// index'); - const plugin = sentryRemixVitePlugin() as Plugin & { - configResolved: (config: ResolvedConfig) => void; - transformIndexHtml: { - order: string; - handler: (html: string) => string; - }; - }; + const plugin = sentryRemixVitePlugin(); const mockConfig: Partial = { root: tempDir, diff --git a/packages/remix/test/integration/instrument.server.mjs b/packages/remix/test/integration/instrument.server.mjs index 5598d81af581..a7f0f1eb8474 100644 --- a/packages/remix/test/integration/instrument.server.mjs +++ b/packages/remix/test/integration/instrument.server.mjs @@ -1,7 +1,35 @@ import * as Sentry from '@sentry/remix'; +import { createTransport } from '@sentry/core'; + +// Global storage for captured envelopes - test helpers will read from this +globalThis.__SENTRY_TEST_ENVELOPES__ = globalThis.__SENTRY_TEST_ENVELOPES__ || []; + +// Create a custom transport that captures envelopes instead of sending them +function makeTestTransport(options) { + function makeRequest(request) { + // Parse the serialized envelope body the same way the test helper's parseEnvelope does + // The body is a serialized string with newline-separated JSON lines + const bodyStr = typeof request.body === 'string' ? request.body : new TextDecoder().decode(request.body); + // Split by newlines and parse each line as JSON - this matches test helper format + const envelope = bodyStr + .split('\n') + .filter(line => line.trim()) + .map(e => JSON.parse(e)); + globalThis.__SENTRY_TEST_ENVELOPES__.push(envelope); + + // Return a successful response + return Promise.resolve({ + statusCode: 200, + headers: {}, + }); + } + + return createTransport(options, makeRequest); +} Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', tracesSampleRate: 1, tracePropagationTargets: ['example.org'], + transport: makeTestTransport, }); diff --git a/packages/remix/test/integration/test/server/utils/helpers.ts b/packages/remix/test/integration/test/server/utils/helpers.ts index b338b783bac0..f042ce07b374 100644 --- a/packages/remix/test/integration/test/server/utils/helpers.ts +++ b/packages/remix/test/integration/test/server/utils/helpers.ts @@ -1,6 +1,7 @@ import * as http from 'http'; import { AddressInfo } from 'net'; import * as path from 'path'; +import { fileURLToPath } from 'url'; import { createRequestHandler } from '@remix-run/express'; import { debug } from '@sentry/core'; import type { EnvelopeItemType, Event, TransactionEvent } from '@sentry/core'; @@ -12,7 +13,6 @@ import express from 'express'; import type { Express } from 'express'; import type { HttpTerminator } from 'http-terminator'; import { createHttpTerminator } from 'http-terminator'; -import nock from 'nock'; type DataCollectorOptions = { // Optional custom URL @@ -107,15 +107,25 @@ class TestEnv { ? [options.envelopeType] : options.envelopeType || (['event'] as EnvelopeItemType[]); + // Use a ref to capture startIndex right before making the request + // The claimed indices mechanism and stopping at count will ensure parallel requests don't interfere + const startIndexRef = { startIndex: null as number | null }; const resProm = this.setupNock( options.count || 1, typeof options.endServer === 'undefined' ? true : options.endServer, envelopeTypeArray, + startIndexRef, ); - // eslint-disable-next-line @typescript-eslint/no-floating-promises - makeRequest(options.method, options.url || this.url, this._axiosConfig); - return resProm; + // Capture startIndex right before making the request + const globalEnvelopesArray = (globalThis as any).__SENTRY_TEST_ENVELOPES__ || []; + startIndexRef.startIndex = globalEnvelopesArray.length; + // Wait for the request to complete so Sentry has time to capture events + await makeRequest(options.method, options.url || this.url, this._axiosConfig); + // Flush Sentry events to ensure they're sent to the transport + await Sentry.flush(2000); + const result = await resProm; + return result; } /** @@ -166,51 +176,104 @@ class TestEnv { count: number, endServer: boolean, envelopeType: EnvelopeItemType[], + startIndexRef?: { startIndex: number | null }, ): Promise[][]> { - return new Promise(resolve => { + return new Promise((resolve, reject) => { const envelopes: Record[][] = []; - const mock = nock('https://dsn.ingest.sentry.io') - .persist() - .post('/api/1337/envelope/', body => { - const envelope = parseEnvelope(body); + let timeoutId: NodeJS.Timeout | null = null; + let checkInterval: NodeJS.Timeout | null = null; + + // Track the starting length to only count envelopes added after the request is made + // If startIndexRef is provided, use it (set right before request); otherwise capture now + let startIndex: number; + if (startIndexRef) { + // Wait for startIndex to be set (it will be set right before request is made) + const getStartIndex = () => { + if (startIndexRef.startIndex === null) { + const globalEnvelopesArray = (globalThis as any).__SENTRY_TEST_ENVELOPES__ || []; + return globalEnvelopesArray.length; + } + return startIndexRef.startIndex; + }; + startIndex = getStartIndex(); + } else { + const globalEnvelopesArray = (globalThis as any).__SENTRY_TEST_ENVELOPES__ || []; + startIndex = globalEnvelopesArray.length; + } - if (envelopeType.includes(envelope[1]?.type as EnvelopeItemType)) { - envelopes.push(envelope); - } else { - return false; + // Use a global Set to track which envelope indices have been claimed + // This prevents parallel setupNock instances from matching the same envelopes + if (!(globalThis as any).__SENTRY_TEST_CLAIMED_ENVELOPE_INDICES__) { + (globalThis as any).__SENTRY_TEST_CLAIMED_ENVELOPE_INDICES__ = new Set(); + } + const claimedIndices = (globalThis as any).__SENTRY_TEST_CLAIMED_ENVELOPE_INDICES__ as Set; + + // Poll for envelopes from the custom transport + const checkForEnvelopes = () => { + // If using ref, wait until it's set (set right before request is made) + if (startIndexRef && startIndexRef.startIndex === null) { + return; // Don't check yet, startIndex hasn't been set + } + + const globalEnvelopes = (globalThis as any).__SENTRY_TEST_ENVELOPES__ || []; + + // Use the ref value if provided, otherwise use the initial startIndex + const currentStartIndex = startIndexRef?.startIndex ?? startIndex; + + // Only check envelopes that were added after the request started + // Check each envelope by its index in the global array + // Stop once we have enough envelopes to avoid claiming more than needed + for (let i = currentStartIndex; i < globalEnvelopes.length && envelopes.length < count; i++) { + // Skip if this envelope index has already been claimed by another setupNock + if (claimedIndices.has(i)) { + continue; } - if (count === envelopes.length) { - nock.removeInterceptor(mock); - - if (endServer) { - // Cleaning nock only before the server is closed, - // not to break tests that use simultaneous requests to the server. - // Ex: Remix scope bleed tests. - nock.cleanAll(); - - // Abort all pending requests to nock to prevent hanging / flakes. - // See: https://github.com/nock/nock/issues/1118#issuecomment-544126948 - nock.abortPendingRequests(); - - this._closeServer() - .catch(e => { - debug.warn(e); - }) - .finally(() => { - resolve(envelopes); - }); - } else { - resolve(envelopes); + const envelope = globalEnvelopes[i]; + // The parsed envelope format is [header, itemHeader, itemPayload] + // where itemHeader has a 'type' property + const itemHeader = envelope[1]; + if (itemHeader && envelopeType.includes(itemHeader.type as EnvelopeItemType)) { + // Check if we've already added this envelope to our local array + if (!envelopes.includes(envelope)) { + // Claim this envelope index so other parallel setupNock instances don't match it + claimedIndices.add(i); + envelopes.push(envelope); + // Stop if we have enough envelopes + if (envelopes.length >= count) { + break; + } } } + } - return true; - }); + if (count === envelopes.length) { + if (timeoutId) clearTimeout(timeoutId); + if (checkInterval) clearInterval(checkInterval); + + if (endServer) { + this._closeServer() + .catch(e => { + debug.warn(e); + }) + .finally(() => { + resolve(envelopes); + }); + } else { + resolve(envelopes); + } + } + }; - mock - .query(true) // accept any query params - used for sentry_key param - .reply(200); + // Check immediately and then poll every 50ms + checkForEnvelopes(); + checkInterval = setInterval(checkForEnvelopes, 50); + + // Add a timeout to detect if Sentry requests never arrive + timeoutId = setTimeout(() => { + if (checkInterval) clearInterval(checkInterval); + reject(new Error(`Timeout waiting for Sentry envelopes. Expected ${count}, got ${envelopes.length}`)); + }, 5000); }); } @@ -224,25 +287,27 @@ class TestEnv { envelopeType: EnvelopeItemType | EnvelopeItemType[]; }): Promise { return new Promise(resolve => { - let reqCount = 0; + const envelopeTypeArray = + typeof options.envelopeType === 'string' ? [options.envelopeType] : options.envelopeType; - const mock = nock('https://dsn.ingest.sentry.io') - .persist() - .post('/api/1337/envelope/', body => { - const envelope = parseEnvelope(body); + // Track the starting length to only count envelopes added after this call + const globalEnvelopesArray = (globalThis as any).__SENTRY_TEST_ENVELOPES__ || []; + const startIndex = globalEnvelopesArray.length; - if (options.envelopeType.includes(envelope[1]?.type as EnvelopeItemType)) { + setTimeout(() => { + const globalEnvelopes = (globalThis as any).__SENTRY_TEST_ENVELOPES__ || []; + // Only count envelopes that were added after this call started + const newEnvelopes = globalEnvelopes.slice(startIndex); + let reqCount = 0; + + for (const envelope of newEnvelopes) { + // The parsed envelope format is [header, itemHeader, itemPayload] + // where itemHeader has a 'type' property + const itemHeader = envelope[1]; + if (itemHeader && envelopeTypeArray.includes(itemHeader.type as EnvelopeItemType)) { reqCount++; - return true; } - - return false; - }); - - setTimeout(() => { - nock.removeInterceptor(mock); - - nock.cleanAll(); + } // eslint-disable-next-line @typescript-eslint/no-floating-promises this._closeServer().then(() => { @@ -266,20 +331,36 @@ export class RemixTestEnv extends TestEnv { } public static async init(): Promise { - let serverPort; - const server = await new Promise(async resolve => { - const app = express(); + const app = express(); - // Vite builds to build/server/index.js instead of build/index.js - app.all('*', createRequestHandler({ build: await import('../../../build/server/index.js') })); + // Import the build module dynamically + const __dirname = path.dirname(fileURLToPath(import.meta.url)); + const buildPath = path.resolve(__dirname, '../../../build/server/index.js'); + const build = await import(buildPath); + const handler = createRequestHandler({ build }); + + app.all('*', async (req, res, next) => { + try { + await handler(req, res); + } catch (e) { + next(e); + } + }); + + return new Promise((resolve, reject) => { const server = app.listen(0, () => { - serverPort = (server.address() as AddressInfo).port; - resolve(server); + const address = server.address(); + if (address && typeof address === 'object') { + resolve(new RemixTestEnv(server, `http://localhost:${address.port}`)); + } else { + server.close(); + reject(new Error('Failed to start server: could not determine port')); + } }); - }); - return new RemixTestEnv(server, `http://localhost:${serverPort}`); + server.on('error', reject); + }); } } diff --git a/packages/replay-canvas/package.json b/packages/replay-canvas/package.json index d24ae95ca6af..c9c513688581 100644 --- a/packages/replay-canvas/package.json +++ b/packages/replay-canvas/package.json @@ -31,8 +31,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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", diff --git a/packages/replay-internal/package.json b/packages/replay-internal/package.json index 6ac7b8590a05..49f3b901c51b 100644 --- a/packages/replay-internal/package.json +++ b/packages/replay-internal/package.json @@ -44,8 +44,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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", diff --git a/packages/replay-internal/rollup.npm.config.mjs b/packages/replay-internal/rollup.npm.config.mjs index 3d6e8fcf4dff..f63bfaf10bcd 100644 --- a/packages/replay-internal/rollup.npm.config.mjs +++ b/packages/replay-internal/rollup.npm.config.mjs @@ -1,4 +1,3 @@ -import nodeResolve from '@rollup/plugin-node-resolve'; import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; export default makeNPMConfigVariants( @@ -22,10 +21,8 @@ export default makeNPMConfigVariants( input: ['./src/worker-bundler.ts'], output: { file: `./build/npm/${format}/worker-bundler.js`, - strict: false, format, }, treeshake: false, - plugins: [nodeResolve()], })), ); diff --git a/packages/replay-worker/package.json b/packages/replay-worker/package.json index 396aa670652c..917649c4d784 100644 --- a/packages/replay-worker/package.json +++ b/packages/replay-worker/package.json @@ -36,8 +36,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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", diff --git a/packages/replay-worker/rollup.examples.config.mjs b/packages/replay-worker/rollup.examples.config.mjs index cbaacbfcb245..207036538f12 100644 --- a/packages/replay-worker/rollup.examples.config.mjs +++ b/packages/replay-worker/rollup.examples.config.mjs @@ -1,45 +1,24 @@ -import commonjs from '@rollup/plugin-commonjs'; -import resolve from '@rollup/plugin-node-resolve'; -import terser from '@rollup/plugin-terser'; -import typescript from '@rollup/plugin-typescript'; -import { defineConfig } from 'rollup'; -import { makeLicensePlugin } from '../../dev-packages/rollup-utils/plugins/index.mjs'; - -const licensePlugin = makeLicensePlugin('Sentry Replay Worker'); +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(), - typescript({ tsconfig: './tsconfig.json', inlineSourceMap: false, sourceMap: false, inlineSources: false }), - 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(), - typescript({ tsconfig: './tsconfig.json', inlineSourceMap: false, sourceMap: false, inlineSources: false }), - 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 556994570335..e4f6a1868af3 100644 --- a/packages/replay-worker/rollup.worker.config.mjs +++ b/packages/replay-worker/rollup.worker.config.mjs @@ -1,45 +1,33 @@ // 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 typescript from '@rollup/plugin-typescript'; -import { defineConfig } from 'rollup'; +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, }, external: ['./worker'], - plugins: [ - typescript({ tsconfig: './tsconfig.json', inlineSourceMap: false, sourceMap: false, inlineSources: false }), - 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(), - typescript({ tsconfig: './tsconfig.json', inlineSourceMap: false, sourceMap: false, inlineSources: false }), - resolve(), - terser({ - mangle: { - module: true, - }, - }), { name: 'worker-to-string', renderChunk(code) { @@ -50,21 +38,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(), - typescript({ tsconfig: './tsconfig.json', inlineSourceMap: false, sourceMap: false, inlineSources: false }), - 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 24cce469ccc3..c26c04b81d46 100644 --- a/packages/replay-worker/tsconfig.json +++ b/packages/replay-worker/tsconfig.json @@ -5,7 +5,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/solid/package.json b/packages/solid/package.json index 8d7b241316ca..83fdf9a0cdaf 100644 --- a/packages/solid/package.json +++ b/packages/solid/package.json @@ -84,13 +84,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: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: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", "circularDepCheck": "madge --circular src/index.ts && madge --circular src/solidrouter.ts && madge --circular src/tanstackrouter.ts", diff --git a/packages/solidstart/package.json b/packages/solidstart/package.json index 7ad53d2db590..94e36532b73f 100644 --- a/packages/solidstart/package.json +++ b/packages/solidstart/package.json @@ -85,13 +85,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: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: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", "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", diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 4847d77da75d..e5111667255e 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -55,13 +55,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", diff --git a/packages/sveltekit/package.json b/packages/sveltekit/package.json index 926b22acc0b8..7dcbc6e45a2b 100644 --- a/packages/sveltekit/package.json +++ b/packages/sveltekit/package.json @@ -67,11 +67,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: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", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", diff --git a/packages/tanstackstart-react/package.json b/packages/tanstackstart-react/package.json index 642b9000c8ba..b8f8549d5467 100644 --- a/packages/tanstackstart-react/package.json +++ b/packages/tanstackstart-react/package.json @@ -60,7 +60,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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", diff --git a/packages/tanstackstart/package.json b/packages/tanstackstart/package.json index a5043986e2b2..7186fcc97d64 100644 --- a/packages/tanstackstart/package.json +++ b/packages/tanstackstart/package.json @@ -42,7 +42,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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", diff --git a/packages/types/package.json b/packages/types/package.json index cd95f72afc88..bb8ce04fca83 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -41,13 +41,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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 sentry-types-*.tgz", diff --git a/packages/vercel-edge/package.json b/packages/vercel-edge/package.json index 9c3df1ef6188..f8b5a84ce574 100644 --- a/packages/vercel-edge/package.json +++ b/packages/vercel-edge/package.json @@ -53,13 +53,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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "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", "circularDepCheck": "madge --circular src/index.ts", 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 f75cb129cfdc..3518e764ea8b 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -57,13 +57,13 @@ "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:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", "build:watch": "run-p build:transpile:watch build:types:watch", "build:dev:watch": "run-p build:transpile:watch build:types: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", diff --git a/packages/wasm/package.json b/packages/wasm/package.json index c6f622b15501..c99729cbaaaa 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -44,16 +44,16 @@ }, "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": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/npm/types build/npm/types-ts3.8 --to ts3.8", "build:watch": "run-p build:transpile:watch build:bundle:watch build:types:watch", - "build:bundle:watch": "rollup --config rollup.bundle.config.mjs --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": "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", "test": "vitest run", diff --git a/yarn.lock b/yarn.lock index 210e9d186cfb..ca2db8828920 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2988,10 +2988,25 @@ lodash "^4.17.21" resolve "^1.20.0" -"@emnapi/runtime@^1.2.0": - version "1.4.3" - resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.4.3.tgz#c0564665c80dc81c448adac23f9dfbed6c838f7d" - integrity sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ== +"@emnapi/core@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.7.1.tgz#3a79a02dbc84f45884a1806ebb98e5746bdfaac4" + integrity sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg== + dependencies: + "@emnapi/wasi-threads" "1.1.0" + tslib "^2.4.0" + +"@emnapi/runtime@^1.2.0", "@emnapi/runtime@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.7.1.tgz#a73784e23f5d57287369c808197288b52276b791" + integrity sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA== + dependencies: + tslib "^2.4.0" + +"@emnapi/wasi-threads@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz#60b2102fddc9ccb78607e4a3cf8403ea69be41bf" + integrity sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ== dependencies: tslib "^2.4.0" @@ -5075,6 +5090,15 @@ dependencies: sparse-bitfield "^3.0.3" +"@napi-rs/wasm-runtime@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.0.tgz#c0180393d7862cff0d412e3e1a7c3bd5ea6d9b2f" + integrity sha512-Fq6DJW+Bb5jaWE69/qOE0D1TUN9+6uWhCeZpdnSBk14pjLcCWR7Q8n49PTSPHazM37JqrsdpEthXy2xn6jWWiA== + dependencies: + "@emnapi/core" "^1.7.1" + "@emnapi/runtime" "^1.7.1" + "@tybys/wasm-util" "^0.10.1" + "@nestjs/common@^10.0.0": version "10.4.15" resolved "https://registry.yarnpkg.com/@nestjs/common/-/common-10.4.15.tgz#27c291466d9100eb86fdbe6f7bbb4d1a6ad55f70" @@ -6232,6 +6256,11 @@ dependencies: "@opentelemetry/core" "^2.0.0" +"@oxc-project/types@=0.101.0": + version "0.101.0" + resolved "https://registry.yarnpkg.com/@oxc-project/types/-/types-0.101.0.tgz#5692200d09d6f87341eac3f8e70e403173c5283e" + integrity sha512-nuFhqlUzJX+gVIPPfuE6xurd4lST3mdcWOhyK/rZO0B9XWMKm79SuszIQEnSMmmDhq1DC8WWVYGVd+6F93o1gQ== + "@parcel/watcher-android-arm64@2.5.1": version "2.5.1" resolved "https://registry.yarnpkg.com/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz#507f836d7e2042f798c7d07ad19c3546f9848ac1" @@ -6694,6 +6723,78 @@ dependencies: web-streams-polyfill "^3.1.1" +"@rolldown/binding-android-arm64@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-beta.53.tgz#3dfce34db89a71956b26affb296dddc2c7dfb728" + integrity sha512-Ok9V8o7o6YfSdTTYA/uHH30r3YtOxLD6G3wih/U9DO0ucBBFq8WPt/DslU53OgfteLRHITZny9N/qCUxMf9kjQ== + +"@rolldown/binding-darwin-arm64@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-beta.53.tgz#d000b0cc5c5fec4032f13806b1ba42c018d7e81d" + integrity sha512-yIsKqMz0CtRnVa6x3Pa+mzTihr4Ty+Z6HfPbZ7RVbk1Uxnco4+CUn7Qbm/5SBol1JD/7nvY8rphAgyAi7Lj6Vg== + +"@rolldown/binding-darwin-x64@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-beta.53.tgz#42cf05245d0a54b3df67307f0f93ac32e8322b5a" + integrity sha512-GTXe+mxsCGUnJOFMhfGWmefP7Q9TpYUseHvhAhr21nCTgdS8jPsvirb0tJwM3lN0/u/cg7bpFNa16fQrjKrCjQ== + +"@rolldown/binding-freebsd-x64@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-beta.53.tgz#c4ee51d63e27298d5cafeb221ca976b1298b3586" + integrity sha512-9Tmp7bBvKqyDkMcL4e089pH3RsjD3SUungjmqWtyhNOxoQMh0fSmINTyYV8KXtE+JkxYMPWvnEt+/mfpVCkk8w== + +"@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-beta.53.tgz#3ecf76c30ab45950d79eb5d38bf9d6d4877e1866" + integrity sha512-a1y5fiB0iovuzdbjUxa7+Zcvgv+mTmlGGC4XydVIsyl48eoxgaYkA3l9079hyTyhECsPq+mbr0gVQsFU11OJAQ== + +"@rolldown/binding-linux-arm64-gnu@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-beta.53.tgz#d0ee79d5cf29e43aa7ac7b327626aee1c405a20b" + integrity sha512-bpIGX+ov9PhJYV+wHNXl9rzq4F0QvILiURn0y0oepbQx+7stmQsKA0DhPGwmhfvF856wq+gbM8L92SAa/CBcLg== + +"@rolldown/binding-linux-arm64-musl@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-beta.53.tgz#2a6bd23ff647b916158100ce24a54b3d1856fb29" + integrity sha512-bGe5EBB8FVjHBR1mOLOPEFg1Lp3//7geqWkU5NIhxe+yH0W8FVrQ6WRYOap4SUTKdklD/dC4qPLREkMMQ855FA== + +"@rolldown/binding-linux-x64-gnu@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-beta.53.tgz#5f1178cc3b9a19c83b5d49737f7774e98dde81fc" + integrity sha512-qL+63WKVQs1CMvFedlPt0U9PiEKJOAL/bsHMKUDS6Vp2Q+YAv/QLPu8rcvkfIMvQ0FPU2WL0aX4eWwF6e/GAnA== + +"@rolldown/binding-linux-x64-musl@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-beta.53.tgz#91deaa186011af99d8b9934af180bffe4fae3d19" + integrity sha512-VGl9JIGjoJh3H8Mb+7xnVqODajBmrdOOb9lxWXdcmxyI+zjB2sux69br0hZJDTyLJfvBoYm439zPACYbCjGRmw== + +"@rolldown/binding-openharmony-arm64@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-beta.53.tgz#44702518f6527d5578f4dd063b2ee85cb3c93a20" + integrity sha512-B4iIserJXuSnNzA5xBLFUIjTfhNy7d9sq4FUMQY3GhQWGVhS2RWWzzDnkSU6MUt7/aHUrep0CdQfXUJI9D3W7A== + +"@rolldown/binding-wasm32-wasi@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-beta.53.tgz#82f5b480895960df59c2a3dc32874b403b698439" + integrity sha512-BUjAEgpABEJXilGq/BPh7jeU3WAJ5o15c1ZEgHaDWSz3LB881LQZnbNJHmUiM4d1JQWMYYyR1Y490IBHi2FPJg== + dependencies: + "@napi-rs/wasm-runtime" "^1.1.0" + +"@rolldown/binding-win32-arm64-msvc@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-beta.53.tgz#489c43aaa7a6088f17ef8d1124b41c4489f40eb9" + integrity sha512-s27uU7tpCWSjHBnxyVXHt3rMrQdJq5MHNv3BzsewCIroIw3DJFjMH1dzCPPMUFxnh1r52Nf9IJ/eWp6LDoyGcw== + +"@rolldown/binding-win32-x64-msvc@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-beta.53.tgz#78bc08543b916082271d7a19b310e24ea6821da7" + integrity sha512-cjWL/USPJ1g0en2htb4ssMjIycc36RvdQAx1WlXnS6DpULswiUTVXPDesTifSKYSyvx24E0YqQkEm0K/M2Z/AA== + +"@rolldown/pluginutils@1.0.0-beta.53": + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.53.tgz#c57a5234ae122671aff6fe72e673a7ed90f03f87" + integrity sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ== + "@rollup/plugin-alias@^5.0.0", "@rollup/plugin-alias@^5.1.1": version "5.1.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-5.1.1.tgz#53601d88cda8b1577aa130b4a6e452283605bf26" @@ -6712,7 +6813,7 @@ magic-string "^0.30.3" picomatch "^4.0.2" -"@rollup/plugin-commonjs@^25.0.4", "@rollup/plugin-commonjs@^25.0.7": +"@rollup/plugin-commonjs@^25.0.4": 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== @@ -6737,13 +6838,6 @@ magic-string "^0.30.3" picomatch "^4.0.2" -"@rollup/plugin-esm-shim@^0.1.5": - version "0.1.5" - resolved "https://registry.yarnpkg.com/@rollup/plugin-esm-shim/-/plugin-esm-shim-0.1.5.tgz#74464e9a8a7e664557aae65592c8a3e317802220" - integrity sha512-xnIjDm/0EbqAw0/rR1UE7eAo9db0ftGPqT8RUCFtkFxtCuspbbmj+wutoyxm32jBytyO3SgkxSG17OR893fV7A== - dependencies: - magic-string "^0.30.3" - "@rollup/plugin-inject@^5.0.5": version "5.0.5" resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-5.0.5.tgz#616f3a73fe075765f91c5bec90176608bed277a3" @@ -6802,7 +6896,7 @@ is-module "^1.0.0" resolve "^1.22.1" -"@rollup/plugin-replace@^5.0.2", "@rollup/plugin-replace@^5.0.5", "@rollup/plugin-replace@^5.0.7": +"@rollup/plugin-replace@^5.0.2", "@rollup/plugin-replace@^5.0.7": version "5.0.7" resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-5.0.7.tgz#150c9ee9db8031d9e4580a61a0edeaaed3d37687" integrity sha512-PqxSfuorkHz/SPpyngLyg5GCEkOcee9M1bkxiVDr41Pd61mqP1PLOoDPbpl44SB2mQGKwV/In74gqQmGITOhEQ== @@ -6818,14 +6912,6 @@ "@rollup/pluginutils" "^5.0.1" magic-string "^0.30.3" -"@rollup/plugin-sucrase@^5.0.2": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@rollup/plugin-sucrase/-/plugin-sucrase-5.0.2.tgz#f8b8b54ad789a47fa882b968a76cede0194eea6e" - integrity sha512-4MhIVH9Dy2Hwose1/x5QMs0XF7yn9jDd/yozHqzdIrMWIolgFpGnrnVhQkqTaK1RALY/fpyrEKmwH/04vr1THA== - dependencies: - "@rollup/pluginutils" "^5.0.1" - sucrase "^3.27.0" - "@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" @@ -6835,14 +6921,6 @@ smob "^1.0.0" terser "^5.17.4" -"@rollup/plugin-typescript@^11.1.6": - version "11.1.6" - resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-11.1.6.tgz#724237d5ec12609ec01429f619d2a3e7d4d1b22b" - integrity sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA== - dependencies: - "@rollup/pluginutils" "^5.1.0" - resolve "^1.22.1" - "@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.0.9", "@rollup/pluginutils@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" @@ -8248,6 +8326,13 @@ "@tufjs/canonical-json" "1.0.0" minimatch "^9.0.0" +"@tybys/wasm-util@^0.10.1": + version "0.10.1" + resolved "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.10.1.tgz#ecddd3205cf1e2d5274649ff0eedd2991ed7f414" + integrity sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg== + dependencies: + tslib "^2.4.0" + "@types/accepts@^1.3.5": version "1.3.5" resolved "https://registry.yarnpkg.com/@types/accepts/-/accepts-1.3.5.tgz#c34bec115cfc746e04fe5a059df4ce7e7b391575" @@ -10565,7 +10650,7 @@ ansicolors@~0.2.1: resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.2.1.tgz#be089599097b74a5c9c4a84a0cdbcdb62bd87aef" integrity sha1-vgiVmQl7dKXJxKhKDNvNtivYeu8= -any-promise@^1.0.0, any-promise@^1.1.0: +any-promise@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= @@ -10827,11 +10912,6 @@ array-equal@^1.0.0: resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= -array-find-index@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" - integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= - array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -13187,7 +13267,7 @@ commander@^2.20.0, commander@^2.20.3, commander@^2.6.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^4.0.0, commander@^4.1.1: +commander@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== @@ -13212,11 +13292,6 @@ comment-parser@1.4.1, comment-parser@^1.1.2: resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.4.1.tgz#bdafead37961ac079be11eb7ec65c4d021eaf9cc" integrity sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg== -commenting@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/commenting/-/commenting-1.1.0.tgz#fae14345c6437b8554f30bc6aa6c1e1633033590" - integrity sha512-YeNK4tavZwtH7jEgK1ZINXzLKm6DZdEMfsaaieOsCAN0S8vsY7UeuO3Q7d/M018EFgE+IeUAuBOKkFccBZsUZA== - common-ancestor-path@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz#4f7d2d1394d91b7abdf51871c62f71eadb0182a7" @@ -16535,11 +16610,6 @@ estree-walker@2.0.2, estree-walker@^2.0.2: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== -estree-walker@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" - integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== - estree-walker@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" @@ -18056,7 +18126,7 @@ glob@^5.0.10: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.4, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.3, glob@~7.2.0: +glob@^7.0.0, glob@^7.0.4, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.3: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -20227,15 +20297,6 @@ jiti@^2.0.0, jiti@^2.1.2, jiti@^2.4.2: resolved "https://registry.yarnpkg.com/jiti/-/jiti-2.4.2.tgz#d19b7732ebb6116b06e2038da74a55366faef560" integrity sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A== -js-cleanup@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/js-cleanup/-/js-cleanup-1.2.0.tgz#8dbc65954b1d38b255f1e8cf02cd17b3f7a053f9" - integrity sha512-JeDD0yiiSt80fXzAVa/crrS0JDPQljyBG/RpOtaSbyDq03VHa9szJWMaWOYU/bcTn412uMN2MxApXq8v79cUiQ== - dependencies: - magic-string "^0.25.7" - perf-regexes "^1.0.1" - skip-regex "^1.0.2" - js-md4@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/js-md4/-/js-md4-0.3.2.tgz#cd3b3dc045b0c404556c81ddb5756c23e59d7cf5" @@ -21291,7 +21352,7 @@ lodash.uniq@^4.2.0, lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@~4.17.21: +lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -21500,7 +21561,7 @@ magic-string@^0.26.0, magic-string@^0.26.7: dependencies: sourcemap-codec "^1.4.8" -magic-string@^0.30.0, magic-string@^0.30.10, magic-string@^0.30.11, magic-string@^0.30.17, magic-string@^0.30.19, magic-string@^0.30.3, magic-string@^0.30.4, magic-string@^0.30.5, magic-string@^0.30.8, magic-string@~0.30.0: +magic-string@^0.30.0, magic-string@^0.30.10, magic-string@^0.30.11, magic-string@^0.30.17, magic-string@^0.30.19, magic-string@^0.30.3, magic-string@^0.30.4, magic-string@^0.30.5, magic-string@^0.30.8: version "0.30.19" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.19.tgz#cebe9f104e565602e5d2098c5f2e79a77cc86da9" integrity sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw== @@ -22609,7 +22670,7 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mkdirp@^3.0.1, mkdirp@~3.0.0: +mkdirp@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg== @@ -22676,11 +22737,6 @@ module-lookup-amd@^9.0.3: requirejs "^2.3.7" requirejs-config-file "^4.0.0" -moment@~2.30.1: - version "2.30.1" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae" - integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how== - mongodb-connection-string-url@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.2.tgz#e223089dfa0a5fa9bf505f8aedcbc67b077b33e7" @@ -22906,15 +22962,6 @@ mysql@^2.18.1: safe-buffer "5.1.2" sqlstring "2.3.1" -mz@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" - integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== - dependencies: - any-promise "^1.0.0" - object-assign "^4.0.1" - thenify-all "^1.0.0" - named-placeholders@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/named-placeholders/-/named-placeholders-1.1.3.tgz#df595799a36654da55dda6152ba7a137ad1d9351" @@ -23876,7 +23923,7 @@ nypm@^0.6.0: pkg-types "^2.0.0" tinyexec "^0.3.2" -object-assign@4.1.1, object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: +object-assign@4.1.1, object-assign@^4, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -24443,11 +24490,6 @@ package-manager-detector@^0.2.0: resolved "https://registry.yarnpkg.com/package-manager-detector/-/package-manager-detector-0.2.0.tgz#160395cd5809181f5a047222319262b8c2d8aaea" integrity sha512-E385OSk9qDcXhcM9LNSe4sdhx8a9mAPrZ4sMLW+tmxl5ZuGtPUcdFu+MPP2jbgiWAZ6Pfe5soGFMd+0Db5Vrog== -package-name-regex@~2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/package-name-regex/-/package-name-regex-2.0.6.tgz#b54bcb04d950e38082b7bb38fa558e01c1679334" - integrity sha512-gFL35q7kbE/zBaPA3UKhp2vSzcPYx2ecbYuwv1ucE9Il6IIgBDweBlH8D68UFGZic2MkllKa2KHCfC1IQBQUYA== - pacote@13.6.2: version "13.6.2" resolved "https://registry.yarnpkg.com/pacote/-/pacote-13.6.2.tgz#0d444ba3618ab3e5cd330b451c22967bbd0ca48a" @@ -24808,11 +24850,6 @@ pend@~1.2.0: resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA= -perf-regexes@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/perf-regexes/-/perf-regexes-1.0.1.tgz#6da1d62f5a94bf9353a0451bccacf69068b75d0b" - integrity sha512-L7MXxUDtqr4PUaLFCDCXBfGV/6KLIuSEccizDI7JxT+c9x1G1v04BQ4+4oag84SHaCdrBgQAIs/Cqn+flwFPng== - perfect-debounce@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/perfect-debounce/-/perfect-debounce-1.0.0.tgz#9c2e8bc30b169cc984a58b7d5b28049839591d2a" @@ -24986,11 +25023,6 @@ pino@9.9.4: sonic-boom "^4.0.1" thread-stream "^3.0.0" -pirates@^4.0.1: - version "4.0.6" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" - integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== - piscina@3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/piscina/-/piscina-3.2.0.tgz#f5a1dde0c05567775690cccefe59d9223924d154" @@ -27186,13 +27218,27 @@ roarr@^7.0.4: safe-stable-stringify "^2.4.1" semver-compare "^1.0.0" -rollup-plugin-cleanup@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-cleanup/-/rollup-plugin-cleanup-3.2.1.tgz#8cbc92ecf58babd7c210051929797f137bbf777c" - integrity sha512-zuv8EhoO3TpnrU8MX8W7YxSbO4gmOR0ny06Lm3nkFfq0IVKdBUtHwhVzY1OAJyNCIAdLiyPnOrU0KnO0Fri1GQ== +rolldown@^1.0.0-beta.53: + version "1.0.0-beta.53" + resolved "https://registry.yarnpkg.com/rolldown/-/rolldown-1.0.0-beta.53.tgz#b1a102a1265d6dcce9ae36f37d6f3aca05bb8ed2" + integrity sha512-Qd9c2p0XKZdgT5AYd+KgAMggJ8ZmCs3JnS9PTMWkyUfteKlfmKtxJbWTHkVakxwXs1Ub7jrRYVeFeF7N0sQxyw== dependencies: - js-cleanup "^1.2.0" - rollup-pluginutils "^2.8.2" + "@oxc-project/types" "=0.101.0" + "@rolldown/pluginutils" "1.0.0-beta.53" + optionalDependencies: + "@rolldown/binding-android-arm64" "1.0.0-beta.53" + "@rolldown/binding-darwin-arm64" "1.0.0-beta.53" + "@rolldown/binding-darwin-x64" "1.0.0-beta.53" + "@rolldown/binding-freebsd-x64" "1.0.0-beta.53" + "@rolldown/binding-linux-arm-gnueabihf" "1.0.0-beta.53" + "@rolldown/binding-linux-arm64-gnu" "1.0.0-beta.53" + "@rolldown/binding-linux-arm64-musl" "1.0.0-beta.53" + "@rolldown/binding-linux-x64-gnu" "1.0.0-beta.53" + "@rolldown/binding-linux-x64-musl" "1.0.0-beta.53" + "@rolldown/binding-openharmony-arm64" "1.0.0-beta.53" + "@rolldown/binding-wasm32-wasi" "1.0.0-beta.53" + "@rolldown/binding-win32-arm64-msvc" "1.0.0-beta.53" + "@rolldown/binding-win32-x64-msvc" "1.0.0-beta.53" rollup-plugin-dts@^6.0.0: version "6.1.1" @@ -27203,21 +27249,6 @@ rollup-plugin-dts@^6.0.0: optionalDependencies: "@babel/code-frame" "^7.24.2" -rollup-plugin-license@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-license/-/rollup-plugin-license-3.3.1.tgz#73b68e33477524198d6f3f9befc905f59bf37c53" - integrity sha512-lwZ/J8QgSnP0unVOH2FQuOBkeiyp0EBvrbYdNU33lOaYD8xP9Zoki+PGoWMD31EUq8Q07GGocSABTYlWMKkwuw== - dependencies: - commenting "~1.1.0" - glob "~7.2.0" - lodash "~4.17.21" - magic-string "~0.30.0" - mkdirp "~3.0.0" - moment "~2.30.1" - package-name-regex "~2.0.6" - spdx-expression-validate "~2.0.0" - spdx-satisfies "~5.0.1" - rollup-plugin-sourcemaps@^0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.6.3.tgz#bf93913ffe056e414419607f1d02780d7ece84ed" @@ -27246,13 +27277,6 @@ rollup-plugin-visualizer@^6.0.3: source-map "^0.7.4" yargs "^17.5.1" -rollup-pluginutils@^2.8.2: - version "2.8.2" - resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" - integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== - dependencies: - estree-walker "^0.6.1" - rollup@^2.70.0, rollup@^2.79.1: version "2.79.2" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.2.tgz#f150e4a5db4b121a21a747d762f701e5e9f49090" @@ -28084,11 +28108,6 @@ size-limit@~11.1.6: picocolors "^1.1.0" tinyglobby "^0.2.7" -skip-regex@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/skip-regex/-/skip-regex-1.0.2.tgz#ac655d77e7c771ac2b9f37585fea37bff56ad65b" - integrity sha512-pEjMUbwJ5Pl/6Vn6FsamXHXItJXSRftcibixDmNCWbWhic0hzHrwkMZo0IZ7fMRH9KxcWDFSkzhccB4285PutA== - slash@3.0.0, slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -28397,15 +28416,6 @@ spawn-args@^0.2.0: resolved "https://registry.yarnpkg.com/spawn-args/-/spawn-args-0.2.0.tgz#fb7d0bd1d70fd4316bd9e3dec389e65f9d6361bb" integrity sha1-+30L0dcP1DFr2ePew4nmX51jYbs= -spdx-compare@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/spdx-compare/-/spdx-compare-1.0.0.tgz#2c55f117362078d7409e6d7b08ce70a857cd3ed7" - integrity sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A== - dependencies: - array-find-index "^1.0.2" - spdx-expression-parse "^3.0.0" - spdx-ranges "^2.0.0" - spdx-correct@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" @@ -28435,32 +28445,11 @@ spdx-expression-parse@^4.0.0: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" -spdx-expression-validate@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/spdx-expression-validate/-/spdx-expression-validate-2.0.0.tgz#25c9408e1c63fad94fff5517bb7101ffcd23350b" - integrity sha512-b3wydZLM+Tc6CFvaRDBOF9d76oGIHNCLYFeHbftFXUWjnfZWganmDmvtM5sm1cRwJc/VDBMLyGGrsLFd1vOxbg== - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids@^3.0.0: version "3.0.7" resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz#e9c18a410e5ed7e12442a549fbd8afa767038d65" integrity sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ== -spdx-ranges@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/spdx-ranges/-/spdx-ranges-2.1.1.tgz#87573927ba51e92b3f4550ab60bfc83dd07bac20" - integrity sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA== - -spdx-satisfies@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/spdx-satisfies/-/spdx-satisfies-5.0.1.tgz#9feeb2524686c08e5f7933c16248d4fdf07ed6a6" - integrity sha512-Nwor6W6gzFp8XX4neaKQ7ChV4wmpSh2sSDemMFSzHxpTw460jxFYeOn+jq4ybnSSw/5sc3pjka9MQPouksQNpw== - dependencies: - spdx-compare "^1.0.0" - spdx-expression-parse "^3.0.0" - spdx-ranges "^2.0.0" - spdy-transport@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdy-transport/-/spdy-transport-3.0.0.tgz#00d4863a6400ad75df93361a1608605e5dcdcf31" @@ -29010,18 +28999,6 @@ stylus@0.59.0, stylus@^0.59.0: sax "~1.2.4" source-map "^0.7.3" -sucrase@^3.27.0, sucrase@^3.35.0, sucrase@getsentry/sucrase#es2020-polyfills: - version "3.36.0" - resolved "https://codeload.github.com/getsentry/sucrase/tar.gz/fd682f6129e507c00bb4e6319cc5d6b767e36061" - dependencies: - "@jridgewell/gen-mapping" "^0.3.2" - commander "^4.0.0" - glob "^10.3.10" - lines-and-columns "^1.1.6" - mz "^2.7.0" - pirates "^4.0.1" - ts-interface-checker "^0.1.9" - suf-log@^2.5.3: version "2.5.3" resolved "https://registry.yarnpkg.com/suf-log/-/suf-log-2.5.3.tgz#0919a7fceea532a99b578c97814c4e335b2d64d1" @@ -29436,20 +29413,6 @@ text-table@0.2.0, text-table@^0.2.0: resolved "https://registry.yarnpkg.com/textextensions/-/textextensions-2.6.0.tgz#d7e4ab13fe54e32e08873be40d51b74229b00fc4" integrity sha512-49WtAWS+tcsy93dRt6P0P3AMD2m5PvXRhuEA0kaXos5ZLlujtYmpmFsB+QvWUSxE1ZsstmYXfQ7L40+EcQgpAQ== -thenify-all@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" - integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== - dependencies: - thenify ">= 3.1.0 < 4" - -"thenify@>= 3.1.0 < 4": - version "3.3.1" - resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" - integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== - dependencies: - any-promise "^1.0.0" - thread-stream@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-3.1.0.tgz#4b2ef252a7c215064507d4ef70c05a5e2d34c4f1" @@ -29789,11 +29752,6 @@ ts-graphviz@^2.1.2: "@ts-graphviz/common" "^2.1.5" "@ts-graphviz/core" "^2.0.7" -ts-interface-checker@^0.1.9: - version "0.1.13" - resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" - integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== - ts-node@10.9.1: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"