@sentry/bundler-plugins 10.64.0 → 10.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/babel-plugin/component-annotation.js +46 -0
- package/build/cjs/babel-plugin/component-annotation.js.map +1 -0
- package/build/cjs/babel-plugin/index.js +19 -49
- package/build/cjs/babel-plugin/index.js.map +1 -1
- package/build/cjs/core/component-annotation-vite-ast.js +27 -0
- package/build/cjs/core/component-annotation-vite-ast.js.map +1 -0
- package/build/cjs/core/component-annotation-vite-fragments.js +91 -0
- package/build/cjs/core/component-annotation-vite-fragments.js.map +1 -0
- package/build/cjs/core/component-annotation-vite-jsx.js +140 -0
- package/build/cjs/core/component-annotation-vite-jsx.js.map +1 -0
- package/build/cjs/core/component-annotation-vite-walk.js +121 -0
- package/build/cjs/core/component-annotation-vite-walk.js.map +1 -0
- package/build/cjs/core/component-annotation-vite.js +101 -0
- package/build/cjs/core/component-annotation-vite.js.map +1 -0
- package/build/cjs/core/index.js +20 -7
- package/build/cjs/core/index.js.map +1 -1
- package/build/cjs/core/version.js +1 -1
- package/build/cjs/core/version.js.map +1 -1
- package/build/cjs/rollup/index.js +52 -3
- package/build/cjs/rollup/index.js.map +1 -1
- package/build/esm/babel-plugin/component-annotation.js +38 -0
- package/build/esm/babel-plugin/component-annotation.js.map +1 -0
- package/build/esm/babel-plugin/index.js +20 -50
- package/build/esm/babel-plugin/index.js.map +1 -1
- package/build/esm/core/component-annotation-vite-ast.js +24 -0
- package/build/esm/core/component-annotation-vite-ast.js.map +1 -0
- package/build/esm/core/component-annotation-vite-fragments.js +89 -0
- package/build/esm/core/component-annotation-vite-fragments.js.map +1 -0
- package/build/esm/core/component-annotation-vite-jsx.js +130 -0
- package/build/esm/core/component-annotation-vite-jsx.js.map +1 -0
- package/build/esm/core/component-annotation-vite-walk.js +119 -0
- package/build/esm/core/component-annotation-vite-walk.js.map +1 -0
- package/build/esm/core/component-annotation-vite.js +94 -0
- package/build/esm/core/component-annotation-vite.js.map +1 -0
- package/build/esm/core/index.js +16 -3
- package/build/esm/core/index.js.map +1 -1
- package/build/esm/core/version.js +1 -1
- package/build/esm/core/version.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/rollup/index.js +52 -3
- package/build/esm/rollup/index.js.map +1 -1
- package/build/types/babel-plugin/component-annotation.d.ts +20 -0
- package/build/types/babel-plugin/component-annotation.d.ts.map +1 -0
- package/build/types/babel-plugin/index.d.ts.map +1 -1
- package/build/types/core/component-annotation-vite-ast.d.ts +57 -0
- package/build/types/core/component-annotation-vite-ast.d.ts.map +1 -0
- package/build/types/core/component-annotation-vite-fragments.d.ts +3 -0
- package/build/types/core/component-annotation-vite-fragments.d.ts.map +1 -0
- package/build/types/core/component-annotation-vite-jsx.d.ts +16 -0
- package/build/types/core/component-annotation-vite-jsx.d.ts.map +1 -0
- package/build/types/core/component-annotation-vite-walk.d.ts +3 -0
- package/build/types/core/component-annotation-vite-walk.d.ts.map +1 -0
- package/build/types/core/component-annotation-vite.d.ts +6 -0
- package/build/types/core/component-annotation-vite.d.ts.map +1 -0
- package/build/types/core/index.d.ts.map +1 -1
- package/build/types/core/version.d.ts +1 -1
- package/build/types/rollup/index.d.ts +7 -1
- package/build/types/rollup/index.d.ts.map +1 -1
- package/build/types-ts3.8/babel-plugin/component-annotation.d.ts +27 -0
- package/build/types-ts3.8/core/component-annotation-vite-ast.d.ts +57 -0
- package/build/types-ts3.8/core/component-annotation-vite-fragments.d.ts +3 -0
- package/build/types-ts3.8/core/component-annotation-vite-jsx.d.ts +16 -0
- package/build/types-ts3.8/core/component-annotation-vite-walk.d.ts +3 -0
- package/build/types-ts3.8/core/component-annotation-vite.d.ts +6 -0
- package/build/types-ts3.8/core/version.d.ts +1 -1
- package/build/types-ts3.8/rollup/index.d.ts +7 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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} from '../core';\nimport type { SourceMap } from 'magic-string';\nimport MagicString from 'magic-string';\nimport type { TransformResult } from 'rollup';\nimport * as path from 'node:path';\nimport { createRequire } from 'node:module';\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\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\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(code: string, id: string): Promise<TransformResult> {\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\n if (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 async function writeBundle(\n outputOptions: { dir?: string; file?: string },\n bundle: { [fileName: string]: unknown },\n ): Promise<void> {\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\n if (shouldTransform) {\n return {\n name,\n buildStart,\n transform,\n renderChunk,\n writeBundle,\n };\n }\n\n return {\n name,\n buildStart,\n renderChunk,\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":[],"mappings":";;;;;;;;;;AAsBA,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,GAAA,GAAM,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AACzC,IAAA,MAAM,MAAA,GAAS,IAAI,QAAQ,CAAA;AAC3B,IAAA,OAAO,MAAA,CAAO,OAAA,EAAS,KAAA,CAAM,GAAG,EAAE,CAAC,CAAA;AAAA,EACrC,CAAA,CAAA,MAAQ;AA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A,MAAM,IAAA,GAAO,UAAU,SAAS,CAAA,OAAA,CAAA;AAEhC,EAAA,IAAI,eAAA,EAAiB;AACnB,IAAA,OAAO;AAAA,MACL,IAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AACF;AAGO,SAAS,kBAAA,CAAmB,WAAA,GAAuB,EAAC,EAAQ;AAGjE,EAAA,OAAO,CAAC,qBAAA,CAAsB,WAAA,EAAa,QAAQ,CAAC,CAAA;AACtD;;;;"}
|
|
1
|
+
{"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} 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 type { TransformResult } from 'rollup';\nimport * as path from 'node:path';\nimport { createRequire } from 'node:module';\n\ntype ViteModule = {\n parseAstAsync?: (code: string, options: { lang: 'jsx' | 'tsx' }) => Promise<unknown>;\n};\n\ntype ViteParseAstAsync = NonNullable<ViteModule['parseAstAsync']>;\ntype ViteAnnotationHooks = {\n transform(\n code: string,\n id: string,\n meta?: ComponentAnnotationTransformMeta,\n ): Promise<ComponentAnnotationTransformResult>;\n};\n\nlet viteParseAstAsyncPromise: Promise<ViteParseAstAsync | null> | 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<ViteParseAstAsync | null> {\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 = <div />;', { 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<ViteAnnotationHooks> | 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<TransformResult> {\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 async function writeBundle(\n outputOptions: { dir?: string; file?: string },\n bundle: { [fileName: string]: unknown },\n ): Promise<void> {\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\n if (shouldTransform) {\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 transform: transformHook,\n renderChunk,\n writeBundle,\n };\n }\n\n return {\n name,\n buildStart,\n renderChunk,\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":[],"mappings":";;;;;;;;;;AAuCA,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,GAAA,GAAM,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AACzC,IAAA,MAAM,MAAA,GAAS,IAAI,QAAQ,CAAA;AAC3B,IAAA,OAAO,MAAA,CAAO,OAAA,EAAS,KAAA,CAAM,GAAG,EAAE,CAAC,CAAA;AAAA,EACrC,CAAA,CAAA,MAAQ;AAAA,EAER;AAEA,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,oBAAA,GAA0D;AACjE,EAAA,IAAI,CAAC,wBAAA,EAA0B;AAC7B,IAAA,wBAAA,GAA2B,OAAA,CAAQ,OAAA,EAAQ,CACxC,IAAA,CAAK,YAAY;AAGhB,MAAA,MAAM,UAAA,GAAa,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,EAAE,MAAM,CAAA;AAExD,MAAA,IAAI,OAAO,UAAA,CAAW,aAAA,KAAkB,UAAA,EAAY;AAClD,QAAA,OAAO,IAAA;AAAA,MACT;AAEA,MAAA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;AACrC,MAAA,MAAM,yBAAyB,eAAA,EAAgB;AAAA,IACjD;AAAA,EACF;AAEA,EAAA,MAAM,IAAA,GAAO,UAAU,SAAS,CAAA,OAAA,CAAA;AAEhC,EAAA,IAAI,eAAA,EAAiB;AACnB,IAAA,MAAM,aAAA,GACJ,cAAc,MAAA,GACV;AAAA,MACE,MAAA,EAAQ,EAAE,EAAA,EAAI,mBAAA,EAAoB;AAAA,MAClC,OAAA,EAAS;AAAA,KACX,GACA,SAAA;AAEN,IAAA,OAAO;AAAA,MACL,IAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA,EAAW,aAAA;AAAA,MACX,WAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AACF;AAGO,SAAS,kBAAA,CAAmB,WAAA,GAAuB,EAAC,EAAQ;AAGjE,EAAA,OAAO,CAAC,qBAAA,CAAsB,WAAA,EAAa,QAAQ,CAAC,CAAA;AACtD;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const WEB_COMPONENT_NAME = "data-sentry-component";
|
|
2
|
+
export declare const WEB_ELEMENT_NAME = "data-sentry-element";
|
|
3
|
+
export declare const WEB_SOURCE_FILE_NAME = "data-sentry-source-file";
|
|
4
|
+
export declare const NATIVE_COMPONENT_NAME = "dataSentryComponent";
|
|
5
|
+
export declare const NATIVE_ELEMENT_NAME = "dataSentryElement";
|
|
6
|
+
export declare const NATIVE_SOURCE_FILE_NAME = "dataSentrySourceFile";
|
|
7
|
+
export type ComponentAnnotationAttributeNames = readonly [string, string, string];
|
|
8
|
+
export type ComponentAnnotationAttribute = [string, string];
|
|
9
|
+
type ComponentAnnotationAttributesInput = {
|
|
10
|
+
attributeNames: ComponentAnnotationAttributeNames;
|
|
11
|
+
componentName: string;
|
|
12
|
+
elementName: string;
|
|
13
|
+
existingAttributes: ReadonlySet<string>;
|
|
14
|
+
ignoredComponents: readonly string[];
|
|
15
|
+
isFragment: boolean;
|
|
16
|
+
sourceFileName?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function getComponentAnnotationAttributes({ attributeNames, componentName, elementName, existingAttributes, ignoredComponents, isFragment, sourceFileName, }: ComponentAnnotationAttributesInput): ComponentAnnotationAttribute[];
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=component-annotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-annotation.d.ts","sourceRoot":"","sources":["../../../src/babel-plugin/component-annotation.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAC1D,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AACtD,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAE9D,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAC3D,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AACvD,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAE9D,MAAM,MAAM,iCAAiC,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAElF,MAAM,MAAM,4BAA4B,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE5D,KAAK,kCAAkC,GAAG;IACxC,cAAc,EAAE,iCAAiC,CAAC;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAIF,wBAAgB,gCAAgC,CAAC,EAC/C,cAAc,EACd,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,cAAc,GACf,EAAE,kCAAkC,GAAG,4BAA4B,EAAE,CAsBrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/babel-plugin/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/babel-plugin/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAmBzD,UAAU,yBAAyB;IACjC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,cAAc;IACd,qBAAqB,CAAC,EAAE,OAAO,GAAG,yBAAyB,CAAC;CAC7D;AAED,UAAU,eAAe;IACvB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,qBAAqB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACpC;AAED,UAAU,oBAAqB,SAAQ,UAAU;IAC/C,IAAI,EAAE,cAAc,CAAC;IACrB,qBAAqB,CAAC,EAAE,eAAe,CAAC;CACzC;AAED,KAAK,gBAAgB,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC;AAwBxD,OAAO,EAAE,uCAAuC,EAAE,MAAM,gBAAgB,CAAC;AAGzE,MAAM,CAAC,OAAO,UAAU,2BAA2B,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,GAAG,gBAAgB,CA8DhG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { isObjectLike } from '@sentry/core';
|
|
2
|
+
import type { SourceMap } from 'magic-string';
|
|
3
|
+
import type { ComponentAnnotationAttribute } from '../babel-plugin/component-annotation';
|
|
4
|
+
export { isObjectLike };
|
|
5
|
+
export type AstNode = {
|
|
6
|
+
type: string;
|
|
7
|
+
start?: number;
|
|
8
|
+
end?: number;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
export type JSXElementNode = AstNode & {
|
|
12
|
+
type: 'JSXElement';
|
|
13
|
+
openingElement: JSXOpeningElementNode;
|
|
14
|
+
children?: AstNode[];
|
|
15
|
+
};
|
|
16
|
+
export type JSXFragmentNode = AstNode & {
|
|
17
|
+
type: 'JSXFragment';
|
|
18
|
+
children?: AstNode[];
|
|
19
|
+
};
|
|
20
|
+
export type JSXRootNode = JSXElementNode | JSXFragmentNode;
|
|
21
|
+
export type JSXOpeningElementNode = AstNode & {
|
|
22
|
+
type: 'JSXOpeningElement';
|
|
23
|
+
name: AstNode;
|
|
24
|
+
attributes?: AstNode[];
|
|
25
|
+
selfClosing?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type FragmentContext = {
|
|
28
|
+
fragmentAliases: Set<string>;
|
|
29
|
+
reactNamespaceAliases: Set<string>;
|
|
30
|
+
};
|
|
31
|
+
export type AttributeInsertion = {
|
|
32
|
+
offset: number;
|
|
33
|
+
attributes: ComponentAnnotationAttribute[];
|
|
34
|
+
};
|
|
35
|
+
export type ParseAstAsync = (code: string, options: {
|
|
36
|
+
lang: 'jsx' | 'tsx';
|
|
37
|
+
}) => Promise<unknown>;
|
|
38
|
+
export type MagicStringLike = {
|
|
39
|
+
appendLeft(offset: number, content: string): void;
|
|
40
|
+
toString(): string;
|
|
41
|
+
generateMap?(options: {
|
|
42
|
+
file?: string;
|
|
43
|
+
source?: string;
|
|
44
|
+
includeContent?: boolean;
|
|
45
|
+
hires?: boolean | 'boundary';
|
|
46
|
+
}): SourceMap | string;
|
|
47
|
+
};
|
|
48
|
+
export type ComponentAnnotationTransformMeta = {
|
|
49
|
+
magicString?: MagicStringLike;
|
|
50
|
+
};
|
|
51
|
+
export type ComponentAnnotationTransformResult = {
|
|
52
|
+
code: string;
|
|
53
|
+
map?: SourceMap | string;
|
|
54
|
+
} | null | undefined;
|
|
55
|
+
export declare function isAstNode(value: unknown): value is AstNode;
|
|
56
|
+
export declare function walkAst(node: unknown, visit: (node: AstNode) => void): void;
|
|
57
|
+
//# sourceMappingURL=component-annotation-vite-ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-annotation-vite-ast.d.ts","sourceRoot":"","sources":["../../../src/core/component-annotation-vite-ast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAEzF,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG;IACrC,IAAI,EAAE,YAAY,CAAC;IACnB,cAAc,EAAE,qBAAqB,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG;IACtC,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAE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,CAAC;CAC1B,GACD,IAAI,GACJ,SAAS,CAAC;AAEd,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAgB3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-annotation-vite-fragments.d.ts","sourceRoot":"","sources":["../../../src/core/component-annotation-vite-fragments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAIhF,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAYpE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AttributeInsertion, FragmentContext, JSXElementNode, JSXFragmentNode, JSXOpeningElementNode, JSXRootNode } from './component-annotation-vite-ast';
|
|
2
|
+
type PendingInsertion = {
|
|
3
|
+
offset: number;
|
|
4
|
+
attributeValues: Map<string, string>;
|
|
5
|
+
};
|
|
6
|
+
export declare function isJSXElement(value: unknown): value is JSXElementNode;
|
|
7
|
+
export declare function isJSXFragment(value: unknown): value is JSXFragmentNode;
|
|
8
|
+
export declare function isJSXRoot(value: unknown): value is JSXRootNode;
|
|
9
|
+
export declare function getStringName(node: unknown): string | null;
|
|
10
|
+
export declare function getJSXName(name: unknown): string;
|
|
11
|
+
export declare function getInsertionOffset(code: string, openingElement: JSXOpeningElementNode): number | null;
|
|
12
|
+
export declare function isReactFragment(openingElement: JSXOpeningElementNode, fragmentContext: FragmentContext): boolean;
|
|
13
|
+
export declare function addPendingAttributes(code: string, openingElement: JSXOpeningElementNode, componentName: string, ignoredComponents: string[], fragmentContext: FragmentContext, sourceFileName: string, insertionsByOffset: Map<number, PendingInsertion>): void;
|
|
14
|
+
export declare function toAttributeInsertions(insertionsByOffset: Map<number, PendingInsertion>): AttributeInsertion[];
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=component-annotation-vite-jsx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-annotation-vite-jsx.d.ts","sourceRoot":"","sources":["../../../src/core/component-annotation-vite-jsx.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,WAAW,EACZ,MAAM,iCAAiC,CAAC;AAOzC,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAEpE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAEtE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAE9D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAE1D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAqBhD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI,CAgBrG;AAED,wBAAgB,eAAe,CAAC,cAAc,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAsBhH;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,qBAAqB,EACrC,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,EAAE,EAC3B,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAChD,IAAI,CAuCN;AAED,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,kBAAkB,EAAE,CAK7G"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AstNode, AttributeInsertion } from './component-annotation-vite-ast';
|
|
2
|
+
export declare function collectViteComponentAnnotationInsertions(code: string, ast: AstNode, ignoredComponents: string[], sourceFileName: string): AttributeInsertion[];
|
|
3
|
+
//# sourceMappingURL=component-annotation-vite-walk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-annotation-vite-walk.d.ts","sourceRoot":"","sources":["../../../src/core/component-annotation-vite-walk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAgC,MAAM,iCAAiC,CAAC;AAajH,wBAAgB,wCAAwC,CACtD,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,OAAO,EACZ,iBAAiB,EAAE,MAAM,EAAE,EAC3B,cAAc,EAAE,MAAM,GACrB,kBAAkB,EAAE,CAYtB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentAnnotationTransformMeta, ComponentAnnotationTransformResult, ParseAstAsync } from './component-annotation-vite-ast';
|
|
2
|
+
export type { ComponentAnnotationTransformMeta, ComponentAnnotationTransformResult, } from './component-annotation-vite-ast';
|
|
3
|
+
export declare function createViteComponentNameAnnotateHooks(ignoredComponents: string[], getParseAstAsync: () => Promise<ParseAstAsync | null>): {
|
|
4
|
+
transform(code: string, id: string, meta?: ComponentAnnotationTransformMeta): Promise<ComponentAnnotationTransformResult>;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=component-annotation-vite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-annotation-vite.d.ts","sourceRoot":"","sources":["../../../src/core/component-annotation-vite.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEV,gCAAgC,EAChC,kCAAkC,EAElC,aAAa,EACd,MAAM,iCAAiC,CAAC;AAEzC,YAAY,EACV,gCAAgC,EAChC,kCAAkC,GACnC,MAAM,iCAAiC,CAAC;AAmHzC,wBAAgB,oCAAoC,CAClD,iBAAiB,EAAE,MAAM,EAAE,EAC3B,gBAAgB,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,GACpD;IACD,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE,gCAAgC,GACtC,OAAO,CAAC,kCAAkC,CAAC,CAAC;CAChD,CAgBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAkD,MAAM,SAAS,CAAC;AA+BxF;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAID,eAAO,MAAM,wBAAwB,QAEiC,CAAC;AAEvE;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGlD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAYxG;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,wBAAgB,gCAAgC,CAAC,iBAAiB,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,OAAO;oBAE3E,IAAI,QAAQ,MAAM,MAAM,MAAM;;;;;;;;;;;;;;;EAkDvD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAIhE;AAED,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,YAAY,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,YAAY,EACZ,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "10.
|
|
1
|
+
export declare const LIB_VERSION = "10.66.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Options } from '../core';
|
|
2
|
+
import type { ComponentAnnotationTransformMeta } from '../core/component-annotation-vite';
|
|
2
3
|
import type { SourceMap } from 'magic-string';
|
|
3
4
|
import MagicString from 'magic-string';
|
|
4
5
|
import type { TransformResult } from 'rollup';
|
|
@@ -14,7 +15,12 @@ export declare function _rollupPluginInternal(userOptions: Options | undefined,
|
|
|
14
15
|
} | {
|
|
15
16
|
name: string;
|
|
16
17
|
buildStart: () => void;
|
|
17
|
-
transform: (code: string, id: string) => Promise<TransformResult
|
|
18
|
+
transform: ((code: string, id: string, meta?: ComponentAnnotationTransformMeta) => Promise<TransformResult>) | {
|
|
19
|
+
filter: {
|
|
20
|
+
id: RegExp;
|
|
21
|
+
};
|
|
22
|
+
handler: (code: string, id: string, meta?: ComponentAnnotationTransformMeta) => Promise<TransformResult>;
|
|
23
|
+
};
|
|
18
24
|
renderChunk: (code: string, chunk: {
|
|
19
25
|
fileName: string;
|
|
20
26
|
facadeModuleId?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rollup/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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KACtC,OAAO,CAAC,IAAI,CAAC;;;sBAlGO,IAAI;wBAyCnB,MAAM,SACL;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,MACvD,OAAO,SACJ;QAAE,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,KACnC;QACD,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,SAAS,CAAC;KACjB,GAAG,IAAI;iCAgDS;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,UACtC;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KACtC,OAAO,CAAC,IAAI,CAAC;;EAwDjB;AAGD,wBAAgB,kBAAkB,CAAC,WAAW,GAAE,OAAY,GAAG,GAAG,CAIjE;AAED,YAAY,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const WEB_COMPONENT_NAME = "data-sentry-component";
|
|
2
|
+
export declare const WEB_ELEMENT_NAME = "data-sentry-element";
|
|
3
|
+
export declare const WEB_SOURCE_FILE_NAME = "data-sentry-source-file";
|
|
4
|
+
export declare const NATIVE_COMPONENT_NAME = "dataSentryComponent";
|
|
5
|
+
export declare const NATIVE_ELEMENT_NAME = "dataSentryElement";
|
|
6
|
+
export declare const NATIVE_SOURCE_FILE_NAME = "dataSentrySourceFile";
|
|
7
|
+
export type ComponentAnnotationAttributeNames = readonly [
|
|
8
|
+
string,
|
|
9
|
+
string,
|
|
10
|
+
string
|
|
11
|
+
];
|
|
12
|
+
export type ComponentAnnotationAttribute = [
|
|
13
|
+
string,
|
|
14
|
+
string
|
|
15
|
+
];
|
|
16
|
+
type ComponentAnnotationAttributesInput = {
|
|
17
|
+
attributeNames: ComponentAnnotationAttributeNames;
|
|
18
|
+
componentName: string;
|
|
19
|
+
elementName: string;
|
|
20
|
+
existingAttributes: ReadonlySet<string>;
|
|
21
|
+
ignoredComponents: readonly string[];
|
|
22
|
+
isFragment: boolean;
|
|
23
|
+
sourceFileName?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function getComponentAnnotationAttributes({ attributeNames, componentName, elementName, existingAttributes, ignoredComponents, isFragment, sourceFileName, }: ComponentAnnotationAttributesInput): ComponentAnnotationAttribute[];
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=component-annotation.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { isObjectLike } from '@sentry/core';
|
|
2
|
+
import { SourceMap } from 'magic-string';
|
|
3
|
+
import { ComponentAnnotationAttribute } from '../babel-plugin/component-annotation';
|
|
4
|
+
export { isObjectLike };
|
|
5
|
+
export type AstNode = {
|
|
6
|
+
type: string;
|
|
7
|
+
start?: number;
|
|
8
|
+
end?: number;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
export type JSXElementNode = AstNode & {
|
|
12
|
+
type: 'JSXElement';
|
|
13
|
+
openingElement: JSXOpeningElementNode;
|
|
14
|
+
children?: AstNode[];
|
|
15
|
+
};
|
|
16
|
+
export type JSXFragmentNode = AstNode & {
|
|
17
|
+
type: 'JSXFragment';
|
|
18
|
+
children?: AstNode[];
|
|
19
|
+
};
|
|
20
|
+
export type JSXRootNode = JSXElementNode | JSXFragmentNode;
|
|
21
|
+
export type JSXOpeningElementNode = AstNode & {
|
|
22
|
+
type: 'JSXOpeningElement';
|
|
23
|
+
name: AstNode;
|
|
24
|
+
attributes?: AstNode[];
|
|
25
|
+
selfClosing?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type FragmentContext = {
|
|
28
|
+
fragmentAliases: Set<string>;
|
|
29
|
+
reactNamespaceAliases: Set<string>;
|
|
30
|
+
};
|
|
31
|
+
export type AttributeInsertion = {
|
|
32
|
+
offset: number;
|
|
33
|
+
attributes: ComponentAnnotationAttribute[];
|
|
34
|
+
};
|
|
35
|
+
export type ParseAstAsync = (code: string, options: {
|
|
36
|
+
lang: 'jsx' | 'tsx';
|
|
37
|
+
}) => Promise<unknown>;
|
|
38
|
+
export type MagicStringLike = {
|
|
39
|
+
appendLeft(offset: number, content: string): void;
|
|
40
|
+
toString(): string;
|
|
41
|
+
generateMap?(options: {
|
|
42
|
+
file?: string;
|
|
43
|
+
source?: string;
|
|
44
|
+
includeContent?: boolean;
|
|
45
|
+
hires?: boolean | 'boundary';
|
|
46
|
+
}): SourceMap | string;
|
|
47
|
+
};
|
|
48
|
+
export type ComponentAnnotationTransformMeta = {
|
|
49
|
+
magicString?: MagicStringLike;
|
|
50
|
+
};
|
|
51
|
+
export type ComponentAnnotationTransformResult = {
|
|
52
|
+
code: string;
|
|
53
|
+
map?: SourceMap | string;
|
|
54
|
+
} | null | undefined;
|
|
55
|
+
export declare function isAstNode(value: unknown): value is AstNode;
|
|
56
|
+
export declare function walkAst(node: unknown, visit: (node: AstNode) => void): void;
|
|
57
|
+
//# sourceMappingURL=component-annotation-vite-ast.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AttributeInsertion, FragmentContext, JSXElementNode, JSXFragmentNode, JSXOpeningElementNode, JSXRootNode } from './component-annotation-vite-ast';
|
|
2
|
+
type PendingInsertion = {
|
|
3
|
+
offset: number;
|
|
4
|
+
attributeValues: Map<string, string>;
|
|
5
|
+
};
|
|
6
|
+
export declare function isJSXElement(value: unknown): value is JSXElementNode;
|
|
7
|
+
export declare function isJSXFragment(value: unknown): value is JSXFragmentNode;
|
|
8
|
+
export declare function isJSXRoot(value: unknown): value is JSXRootNode;
|
|
9
|
+
export declare function getStringName(node: unknown): string | null;
|
|
10
|
+
export declare function getJSXName(name: unknown): string;
|
|
11
|
+
export declare function getInsertionOffset(code: string, openingElement: JSXOpeningElementNode): number | null;
|
|
12
|
+
export declare function isReactFragment(openingElement: JSXOpeningElementNode, fragmentContext: FragmentContext): boolean;
|
|
13
|
+
export declare function addPendingAttributes(code: string, openingElement: JSXOpeningElementNode, componentName: string, ignoredComponents: string[], fragmentContext: FragmentContext, sourceFileName: string, insertionsByOffset: Map<number, PendingInsertion>): void;
|
|
14
|
+
export declare function toAttributeInsertions(insertionsByOffset: Map<number, PendingInsertion>): AttributeInsertion[];
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=component-annotation-vite-jsx.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AstNode, AttributeInsertion } from './component-annotation-vite-ast';
|
|
2
|
+
export declare function collectViteComponentAnnotationInsertions(code: string, ast: AstNode, ignoredComponents: string[], sourceFileName: string): AttributeInsertion[];
|
|
3
|
+
//# sourceMappingURL=component-annotation-vite-walk.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentAnnotationTransformMeta, ComponentAnnotationTransformResult, ParseAstAsync } from './component-annotation-vite-ast';
|
|
2
|
+
export { ComponentAnnotationTransformMeta, ComponentAnnotationTransformResult, } from './component-annotation-vite-ast';
|
|
3
|
+
export declare function createViteComponentNameAnnotateHooks(ignoredComponents: string[], getParseAstAsync: () => Promise<ParseAstAsync | null>): {
|
|
4
|
+
transform(code: string, id: string, meta?: ComponentAnnotationTransformMeta): Promise<ComponentAnnotationTransformResult>;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=component-annotation-vite.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "10.
|
|
1
|
+
export declare const LIB_VERSION = "10.66.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Options } from '../core';
|
|
2
|
+
import { ComponentAnnotationTransformMeta } from '../core/component-annotation-vite';
|
|
2
3
|
import { SourceMap } from 'magic-string';
|
|
3
4
|
import MagicString from 'magic-string';
|
|
4
5
|
import { TransformResult } from 'rollup';
|
|
@@ -14,7 +15,12 @@ export declare function _rollupPluginInternal(userOptions: Options | undefined,
|
|
|
14
15
|
} | {
|
|
15
16
|
name: string;
|
|
16
17
|
buildStart: () => void;
|
|
17
|
-
transform: (code: string, id: string) => Promise<TransformResult
|
|
18
|
+
transform: ((code: string, id: string, meta?: ComponentAnnotationTransformMeta) => Promise<TransformResult>) | {
|
|
19
|
+
filter: {
|
|
20
|
+
id: RegExp;
|
|
21
|
+
};
|
|
22
|
+
handler: (code: string, id: string, meta?: ComponentAnnotationTransformMeta) => Promise<TransformResult>;
|
|
23
|
+
};
|
|
18
24
|
renderChunk: (code: string, chunk: {
|
|
19
25
|
fileName: string;
|
|
20
26
|
facadeModuleId?: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/bundler-plugins",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.66.0",
|
|
4
4
|
"description": "Sentry Bundler Plugins",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/main/packages/bundler-plugins",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@babel/core": "^7.18.5",
|
|
114
114
|
"@sentry/cli": "^2.58.6",
|
|
115
|
-
"@sentry/core": "10.
|
|
116
|
-
"dotenv": "^
|
|
115
|
+
"@sentry/core": "10.66.0",
|
|
116
|
+
"dotenv": "^17.4.2",
|
|
117
117
|
"find-up": "^5.0.0",
|
|
118
118
|
"glob": "^13.0.6",
|
|
119
119
|
"magic-string": "~0.30.8"
|