{"version":3,"file":"index.js","sources":["../../../src/rollup/index.ts"],"sourcesContent":["import type { Options } from '../core';\nimport {\n createSentryBuildPluginManager,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n isJsFile,\n shouldSkipCodeInjection,\n getDebugIdSnippet,\n stringToUUID,\n COMMENT_USE_STRICT_REGEX,\n createDebugIdUploadFunction,\n globFiles,\n createComponentNameAnnotateHooks,\n replaceBooleanFlagsInCode,\n CodeInjection,\n stampDebugId,\n} from '../core';\nimport type {\n ComponentAnnotationTransformMeta,\n ComponentAnnotationTransformResult,\n} from '../core/component-annotation-vite';\nimport type { SourceMap } from 'magic-string';\nimport MagicString from 'magic-string';\nimport * as path from 'node:path';\nimport { createRequire } from 'node:module';\n\n// The subset of Rollup's `TransformResult` that this plugin's `transform`\n// hook actually returns. Defined locally instead of imported from `rollup`\n// because `rollup` is an optional dependency.\ntype TransformResult = { code: string; map?: SourceMap | string | { mappings: string } | null } | null | undefined;\n\n// The subset of Rollup's `OutputBundle` the stamping hook reads.\ntype OutputBundle = Record<\n string,\n | { type: 'chunk'; fileName: string; code: string; sourcemapFileName?: string | null }\n | { type: 'asset'; fileName: string; source: string | Uint8Array }\n>;\n\ntype ViteModule = {\n parseAstAsync?: (code: string, options: { lang: 'jsx' | 'tsx' }) => Promise;\n};\n\ntype ViteParseAstAsync = NonNullable;\ntype ViteAnnotationHooks = {\n transform(\n code: string,\n id: string,\n meta?: ComponentAnnotationTransformMeta,\n ): Promise;\n};\n\nlet viteParseAstAsyncPromise: Promise | undefined;\n\nconst JS_MODULE_ID_FILTER = /\\.[cm]?[jt]sx?(?:[?#].*)?$/;\n\nfunction hasExistingDebugID(code: string): boolean {\n // Check if a debug ID has already been injected to avoid duplicate injection (e.g. by another plugin or Sentry CLI)\n const chunkStartSnippet = code.slice(0, 6000);\n const chunkEndSnippet = code.slice(-500);\n\n if (chunkStartSnippet.includes('_sentryDebugIdIdentifier') || chunkEndSnippet.includes('//# debugId=')) {\n return true; // Debug ID already present, skip injection\n }\n\n return false;\n}\n\nfunction getRollupMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Rollup already transpiles this for us\n const req = createRequire(import.meta.url);\n const rollup = req('rollup') as { VERSION?: string };\n return rollup.VERSION?.split('.')[0];\n } catch {\n // do nothing, we'll just not report a version\n }\n\n return undefined;\n}\n\nfunction getViteParseAstAsync(): Promise {\n if (!viteParseAstAsyncPromise) {\n viteParseAstAsyncPromise = Promise.resolve()\n .then(async () => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Vite is an optional runtime peer for this package\n const viteModule = createRequire(import.meta.url)('vite') as ViteModule;\n\n if (typeof viteModule.parseAstAsync !== 'function') {\n return null;\n }\n\n try {\n await viteModule.parseAstAsync('const x =
;', { lang: 'tsx' });\n } catch {\n return null;\n }\n\n return viteModule.parseAstAsync;\n })\n .catch(() => null);\n }\n\n return viteParseAstAsyncPromise;\n}\n\n/**\n * @ignore - this is the internal plugin factory function only used for the Vite plugin!\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function _rollupPluginInternal(\n userOptions: Options = {},\n buildTool: 'rollup' | 'vite',\n buildToolMajorVersion?: string,\n) {\n const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {\n loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[sentry-${buildTool}-plugin]`,\n buildTool,\n buildToolMajorVersion: buildToolMajorVersion || getRollupMajorVersion(),\n });\n\n const {\n logger,\n normalizedOptions: options,\n bundleSizeOptimizationReplacementValues: replacementValues,\n bundleMetadata,\n createDependencyOnBuildArtifacts,\n } = sentryBuildPluginManager;\n\n if (options.disable) {\n return {\n name: 'sentry-noop-plugin',\n };\n }\n\n if (process.cwd().match(/\\\\node_modules\\\\|\\/node_modules\\//)) {\n logger.warn('Running Sentry plugin from within a `node_modules` folder. Some features may not work.');\n }\n\n const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();\n const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });\n const sourcemapsEnabled = options.sourcemaps?.disable !== true;\n const staticInjectionCode = new CodeInjection();\n\n if (!options.release.inject) {\n logger.debug('Release injection disabled via `release.inject` option. Will not inject release.');\n } else if (!options.release.name) {\n logger.debug(\n 'No release name provided. Will not inject release. Please set the `release.name` option to identify your release.',\n );\n } else {\n staticInjectionCode.append(\n generateReleaseInjectorCode({\n release: options.release.name,\n injectBuildInformation: options._experiments.injectBuildInformation || false,\n }),\n );\n }\n\n if (Object.keys(bundleMetadata).length > 0) {\n staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));\n }\n\n const transformAnnotations = options.reactComponentAnnotation?.enabled\n ? createComponentNameAnnotateHooks(\n options.reactComponentAnnotation?.ignoredComponents || [],\n !!options.reactComponentAnnotation?._experimentalInjectIntoHtml,\n )\n : undefined;\n const transformViteAnnotations =\n options.reactComponentAnnotation?.enabled &&\n buildTool === 'vite' &&\n buildToolMajorVersion === '8' &&\n !options.reactComponentAnnotation?._experimentalInjectIntoHtml\n ? (() => {\n let viteAnnotationHooksPromise: Promise | undefined;\n\n return {\n transform(code: string, id: string, meta?: ComponentAnnotationTransformMeta) {\n if (!viteAnnotationHooksPromise) {\n viteAnnotationHooksPromise = import('../core/component-annotation-vite').then(\n ({ createViteComponentNameAnnotateHooks }) =>\n createViteComponentNameAnnotateHooks(\n options.reactComponentAnnotation?.ignoredComponents || [],\n getViteParseAstAsync,\n ),\n );\n }\n\n return viteAnnotationHooksPromise.then(hooks => hooks.transform(code, id, meta));\n },\n };\n })()\n : undefined;\n\n const transformReplace = Object.keys(replacementValues).length > 0;\n const shouldTransform = transformAnnotations || transformReplace;\n\n function buildStart(): void {\n void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {\n // Telemetry failures are acceptable\n });\n }\n\n async function transform(\n code: string,\n id: string,\n meta?: ComponentAnnotationTransformMeta,\n ): Promise {\n // Component annotations are only in user code and boolean flag replacements are\n // only in Sentry code. If we successfully add annotations, we can return early.\n let shouldRunBabelAnnotations = true;\n\n if (transformViteAnnotations?.transform) {\n const result = await transformViteAnnotations.transform(code, id, meta);\n if (result) {\n return result;\n }\n\n if (result === null) {\n shouldRunBabelAnnotations = false;\n }\n }\n\n if (shouldRunBabelAnnotations && transformAnnotations?.transform) {\n const result = await transformAnnotations.transform(code, id);\n if (result) {\n return result;\n }\n }\n\n if (transformReplace) {\n return replaceBooleanFlagsInCode(code, replacementValues);\n }\n\n return null;\n }\n\n function renderChunk(\n code: string,\n chunk: { fileName: string; facadeModuleId?: string | null },\n _?: unknown,\n meta?: { magicString?: MagicString },\n ): {\n code: string;\n map?: SourceMap;\n } | null {\n if (!isJsFile(chunk.fileName)) {\n return null; // returning null means not modifying the chunk at all\n }\n\n // Skip empty chunks and HTML facade chunks (Vite MPA)\n if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) {\n return null;\n }\n\n const injectCode = staticInjectionCode.clone();\n\n if (sourcemapsEnabled && !hasExistingDebugID(code)) {\n const debugId = stringToUUID(code); // generate a deterministic debug ID\n injectCode.append(getDebugIdSnippet(debugId));\n }\n\n if (injectCode.isEmpty()) {\n return null;\n }\n\n const ms = meta?.magicString || new MagicString(code, { filename: chunk.fileName });\n const match = code.match(COMMENT_USE_STRICT_REGEX)?.[0];\n\n if (match) {\n // Add injected code after any comments or \"use strict\" at the beginning of the bundle.\n ms.appendLeft(match.length, injectCode.code());\n } else {\n // ms.replace() doesn't work when there is an empty string match (which happens if\n // there is neither, a comment, nor a \"use strict\" at the top of the chunk) so we\n // need this special case here.\n ms.prepend(injectCode.code());\n }\n\n // Rolldown can pass a native MagicString instance in meta.magicString\n // https://rolldown.rs/in-depth/native-magic-string#usage-examples\n if (ms?.constructor?.name === 'BindingMagicString') {\n // Rolldown docs say to return the magic string instance directly in this case\n return { code: ms as unknown as string };\n }\n\n return {\n code: ms.toString(),\n map: ms.generateMap({ file: chunk.fileName, hires: 'boundary' as unknown as undefined }),\n };\n }\n\n /**\n * Stamps debug IDs into the emitted chunks and source maps.\n *\n * `disable-upload` skips the upload routine (which stamps debug IDs into temp copies), so the emitted\n * artifacts get stamped here instead. Not in `renderChunk`: minifiers running after it would strip the\n * comment. Rollup computes `[hash]` file names before this hook, so only plugins that hash the final\n * assets afterwards (e.g. subresource integrity) see the stamped content.\n */\n function generateBundle(_outputOptions: unknown, bundle: OutputBundle): void {\n for (const output of Object.values(bundle)) {\n if (output.type !== 'chunk' || !isJsFile(output.fileName)) {\n continue;\n }\n\n const sourceMapAsset = bundle[output.sourcemapFileName ?? `${output.fileName}.map`];\n const sourceMapSource =\n sourceMapAsset?.type === 'asset' && typeof sourceMapAsset.source === 'string'\n ? sourceMapAsset.source\n : undefined;\n\n const stamped = stampDebugId(output.code, sourceMapSource);\n if (!stamped) {\n continue;\n }\n\n output.code = stamped.bundleSource;\n if (stamped.sourceMapSource !== undefined && sourceMapAsset?.type === 'asset') {\n sourceMapAsset.source = stamped.sourceMapSource;\n }\n }\n }\n\n async function writeBundle(\n outputOptions: { dir?: string; file?: string },\n bundle: { [fileName: string]: unknown },\n ): Promise {\n try {\n await sentryBuildPluginManager.createRelease();\n\n if (sourcemapsEnabled && options.sourcemaps?.disable !== 'disable-upload') {\n if (outputOptions.dir) {\n const outputDir = outputOptions.dir;\n const JS_AND_MAP_PATTERNS = [\n '/**/*.js',\n '/**/*.mjs',\n '/**/*.cjs',\n '/**/*.js.map',\n '/**/*.mjs.map',\n '/**/*.cjs.map',\n ].map(q => `${q}?(\\\\?*)?(#*)`); // We want to allow query and hash strings at the end of files\n const buildArtifacts = await globFiles(JS_AND_MAP_PATTERNS, { root: outputDir });\n await upload(buildArtifacts);\n } else if (outputOptions.file) {\n await upload([outputOptions.file]);\n } else {\n const buildArtifacts = Object.keys(bundle).map(asset => path.join(path.resolve(), asset));\n await upload(buildArtifacts);\n }\n }\n } finally {\n freeGlobalDependencyOnBuildArtifacts();\n await sentryBuildPluginManager.deleteArtifacts();\n }\n }\n\n const name = `sentry-${buildTool}-plugin`;\n const transformHook =\n buildTool === 'vite'\n ? {\n filter: { id: JS_MODULE_ID_FILTER },\n handler: transform,\n }\n : transform;\n\n return {\n name,\n buildStart,\n ...(shouldTransform ? { transform: transformHook } : {}),\n renderChunk,\n ...(options.sourcemaps?.disable === 'disable-upload'\n ? { generateBundle: { order: 'pre' as const, handler: generateBundle } }\n : {}),\n writeBundle,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-explicit-any\nexport function sentryRollupPlugin(userOptions: Options = {}): any {\n // We return an array here so we don't break backwards compatibility with what\n // unplugin used to return\n return [_rollupPluginInternal(userOptions, 'rollup')];\n}\n\nexport type { Options as SentryRollupPluginOptions } from '../core';\nexport { sentryCliBinaryExists } from '../core';\n"],"names":["createRequire","createSentryBuildPluginManager","createDebugIdUploadFunction","CodeInjection","generateReleaseInjectorCode","generateModuleMetadataInjectorCode","createComponentNameAnnotateHooks","replaceBooleanFlagsInCode","isJsFile","shouldSkipCodeInjection","stringToUUID","getDebugIdSnippet","MagicString","COMMENT_USE_STRICT_REGEX","stampDebugId","globFiles","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAI,wBAAA;AAEJ,MAAM,mBAAA,GAAsB,4BAAA;AAE5B,SAAS,mBAAmB,IAAA,EAAuB;AAEjD,EAAA,MAAM,iBAAA,GAAoB,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,GAAI,CAAA;AAC5C,EAAA,MAAM,eAAA,GAAkB,IAAA,CAAK,KAAA,CAAM,IAAI,CAAA;AAEvC,EAAA,IAAI,kBAAkB,QAAA,CAAS,0BAA0B,KAAK,eAAA,CAAgB,QAAA,CAAS,cAAc,CAAA,EAAG;AACtG,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,qBAAA,GAA4C;AACnD,EAAA,IAAI;AAGF,IAAA,MAAM,G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