diff --git a/.craft.yml b/.craft.yml index c5e537806bcb..a6a739ead8bc 100644 --- a/.craft.yml +++ b/.craft.yml @@ -145,6 +145,18 @@ targets: - name: npm id: '@sentry/bundler-plugins' includeNames: /^sentry-bundler-plugins-\d.*\.tgz$/ + - name: npm + id: '@sentry/esbuild-plugin' + includeNames: /^sentry-esbuild-plugin-\d.*\.tgz$/ + - name: npm + id: '@sentry/rollup-plugin' + includeNames: /^sentry-rollup-plugin-\d.*\.tgz$/ + - name: npm + id: '@sentry/vite-plugin' + includeNames: /^sentry-vite-plugin-\d.*\.tgz$/ + - name: npm + id: '@sentry/webpack-plugin' + includeNames: /^sentry-webpack-plugin-\d.*\.tgz$/ - name: npm id: '@sentry/typescript' includeNames: /^sentry-typescript-\d.*\.tgz$/ diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 499244434f82..5f6a5a8fdf55 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -64,6 +64,10 @@ body: - '@sentry/tanstackstart-react' - '@sentry/vue' - '@sentry/wasm' + - '@sentry/esbuild-plugin' + - '@sentry/rollup-plugin' + - '@sentry/vite-plugin' + - '@sentry/webpack-plugin' - Sentry Browser Loader - Sentry Browser CDN bundle validations: diff --git a/.github/workflows/issue-package-label.yml b/.github/workflows/issue-package-label.yml index fb77747f336f..8ac1c7987801 100644 --- a/.github/workflows/issue-package-label.yml +++ b/.github/workflows/issue-package-label.yml @@ -122,6 +122,18 @@ jobs: "@sentry.wasm": { "label": "WASM" }, + "@sentry.esbuild-plugin": { + "label": "Feature: Source Maps" + }, + "@sentry.rollup-plugin": { + "label": "Feature: Source Maps" + }, + "@sentry.vite-plugin": { + "label": "Feature: Source Maps" + }, + "@sentry.webpack-plugin": { + "label": "Feature: Source Maps" + }, "Sentry.Browser.Loader": { "label": "Browser" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index 0727144b61f9..5571f47fb4eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott +### Important Changes + +- **feat(bundler-plugins): Release `@sentry/webpack-plugin`, `@sentry/vite-plugin`, `@sentry/rollup-plugin` and `@sentry/esbuild-plugin` from the SDK repository ([#25095](https://github.com/getsentry/sentry-javascript/pull/25095))** + + The four standalone bundler plugins now release together with the SDK, so their version jumps from 5.4.1 to the SDK version. Each package re-exports the matching `@sentry/bundler-plugins` entry point, which we recommend for new projects. The plugin options do not change, but the update brings these breaking changes: + + - Node.js 20.19.0 or higher is required. + - `@sentry/webpack-plugin` requires webpack 5.1 or higher. The `@sentry/webpack-plugin/webpack5` entry point still works and exports the same plugin as `@sentry/webpack-plugin`. + - The plugins use the `sentry` CLI SDK instead of `@sentry/cli`. Sentry self-hosted 26.4.2 or higher is supported. Lower versions may continue to work. + - Deploys that the plugins create on Vercel use the value of `VERCEL_TARGET_ENV` (`production`, `preview` or a custom name) as their environment, instead of `vercel-production` or `vercel-preview`. To keep the old value, set `release.deploy.env`. + ## 11.7.0 ### Important Changes diff --git a/package.json b/package.json index d009220ac089..3e0beef30732 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "packages/effect", "packages/ember", "packages/elysia", + "packages/esbuild-plugin", "packages/eslint-config-sdk", "packages/eslint-plugin-sdk", "packages/feedback", @@ -88,6 +89,7 @@ "packages/replay-internal", "packages/replay-canvas", "packages/replay-worker", + "packages/rollup-plugin", "packages/server-runtime-injection", "packages/server-utils", "packages/solid", @@ -97,8 +99,10 @@ "packages/tanstackstart-react", "packages/typescript", "packages/vercel-edge", + "packages/vite-plugin", "packages/vue", "packages/wasm", + "packages/webpack-plugin", "dev-packages/browser-integration-tests", "dev-packages/bundler-plugin-integration-tests", "dev-packages/e2e-tests", diff --git a/packages/esbuild-plugin/.gitignore b/packages/esbuild-plugin/.gitignore new file mode 100644 index 000000000000..22cfeae206b4 --- /dev/null +++ b/packages/esbuild-plugin/.gitignore @@ -0,0 +1,2 @@ +build +*.tgz diff --git a/packages/esbuild-plugin/LICENSE b/packages/esbuild-plugin/LICENSE new file mode 100644 index 000000000000..c23a90edc9be --- /dev/null +++ b/packages/esbuild-plugin/LICENSE @@ -0,0 +1,29 @@ +# MIT License + +Copyright (c) 2022-2026, Sentry +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/esbuild-plugin/README.md b/packages/esbuild-plugin/README.md new file mode 100644 index 000000000000..72ba4460548e --- /dev/null +++ b/packages/esbuild-plugin/README.md @@ -0,0 +1,45 @@ +

+ + Sentry + +

+ +# Sentry esbuild Plugin + +A esbuild plugin that uploads source maps to Sentry and injects release and Debug ID information into your bundles. + +This package re-exports `@sentry/bundler-plugins/esbuild`. + +## Installation + +```bash +npm install @sentry/esbuild-plugin --save-dev +``` + +## Usage + +```js +// build.js +import * as esbuild from 'esbuild'; +import { sentryEsbuildPlugin } from '@sentry/esbuild-plugin'; + +await esbuild.build({ + sourcemap: true, + plugins: [ + sentryEsbuildPlugin({ + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, + authToken: process.env.SENTRY_AUTH_TOKEN, + }), + ], +}); +``` + +## Documentation + +- [Uploading source maps](https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/) + +## Support + +- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose) +- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md) diff --git a/packages/esbuild-plugin/package.json b/packages/esbuild-plugin/package.json new file mode 100644 index 000000000000..0f85f5c61ef0 --- /dev/null +++ b/packages/esbuild-plugin/package.json @@ -0,0 +1,56 @@ +{ + "name": "@sentry/esbuild-plugin", + "version": "11.7.0", + "description": "Official Sentry esbuild plugin", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/develop/packages/esbuild-plugin", + "author": "Sentry", + "license": "MIT", + "keywords": [ + "Sentry", + "esbuild", + "bundler", + "plugin" + ], + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "/build" + ], + "main": "build/cjs/index.js", + "module": "build/esm/index.js", + "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./build/types/index.d.ts", + "import": "./build/esm/index.js", + "require": "./build/cjs/index.js" + } + }, + "scripts": { + "build": "run-p build:transpile build:types", + "build:dev": "yarn build", + "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:types": "tsc -p tsconfig.types.json", + "build:watch": "run-p build:transpile:watch", + "build:dev:watch": "yarn build:watch", + "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:tarball": "npm pack", + "clean": "rimraf build coverage sentry-esbuild-plugin-*.tgz", + "lint": "oxlint . --type-aware", + "lint:fix": "oxlint . --fix --type-aware", + "test": "vitest run", + "test:unit": "vitest run" + }, + "dependencies": { + "@sentry/bundler-plugins": "11.7.0" + }, + "volta": { + "extends": "../../package.json" + } +} diff --git a/packages/esbuild-plugin/rollup.npm.config.mjs b/packages/esbuild-plugin/rollup.npm.config.mjs new file mode 100644 index 000000000000..b11c2c4f9148 --- /dev/null +++ b/packages/esbuild-plugin/rollup.npm.config.mjs @@ -0,0 +1,12 @@ +import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; + +export default makeNPMConfigVariants( + makeBaseNPMConfig({ + entrypoints: ['src/index.ts'], + packageSpecificConfig: { + output: { + exports: 'named', + }, + }, + }), +); diff --git a/packages/esbuild-plugin/src/index.ts b/packages/esbuild-plugin/src/index.ts new file mode 100644 index 000000000000..142a16901164 --- /dev/null +++ b/packages/esbuild-plugin/src/index.ts @@ -0,0 +1,2 @@ +export * from '@sentry/bundler-plugins/esbuild'; +export { default } from '@sentry/bundler-plugins/esbuild'; diff --git a/packages/esbuild-plugin/test/index.test.ts b/packages/esbuild-plugin/test/index.test.ts new file mode 100644 index 000000000000..d92084cfd902 --- /dev/null +++ b/packages/esbuild-plugin/test/index.test.ts @@ -0,0 +1,14 @@ +import * as bundlerPlugins from '@sentry/bundler-plugins/esbuild'; +import { describe, expect, it } from 'vitest'; +import * as plugin from '../src/index'; + +describe('@sentry/esbuild-plugin', () => { + it('re-exports @sentry/bundler-plugins/esbuild', () => { + expect(plugin.sentryEsbuildPlugin).toBe(bundlerPlugins.sentryEsbuildPlugin); + expect(Object.keys(plugin).sort()).toEqual(Object.keys(bundlerPlugins).sort()); + }); + + it('re-exports the default export', () => { + expect(plugin.default).toBe(bundlerPlugins.default); + }); +}); diff --git a/packages/esbuild-plugin/test/tsconfig.json b/packages/esbuild-plugin/test/tsconfig.json new file mode 100644 index 000000000000..76d0c9cff6f2 --- /dev/null +++ b/packages/esbuild-plugin/test/tsconfig.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../tsconfig.json", + "include": ["../src/**/*", "./**/*"], + "compilerOptions": { + "types": ["node"] + } +} diff --git a/packages/esbuild-plugin/tsconfig.json b/packages/esbuild-plugin/tsconfig.json new file mode 100644 index 000000000000..2044e12308ea --- /dev/null +++ b/packages/esbuild-plugin/tsconfig.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts", "./package.json"] +} diff --git a/packages/esbuild-plugin/tsconfig.types.json b/packages/esbuild-plugin/tsconfig.types.json new file mode 100644 index 000000000000..9321489cd9a9 --- /dev/null +++ b/packages/esbuild-plugin/tsconfig.types.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "./tsconfig.json", + "include": ["./src/**/*"], + "compilerOptions": { + "rootDir": "./src", + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "build/types" + } +} diff --git a/packages/esbuild-plugin/vite.config.ts b/packages/esbuild-plugin/vite.config.ts new file mode 100644 index 000000000000..f18ec92095bc --- /dev/null +++ b/packages/esbuild-plugin/vite.config.ts @@ -0,0 +1,8 @@ +import baseConfig from '../../vite/vite.config'; + +export default { + ...baseConfig, + test: { + ...baseConfig.test, + }, +}; diff --git a/packages/rollup-plugin/.gitignore b/packages/rollup-plugin/.gitignore new file mode 100644 index 000000000000..22cfeae206b4 --- /dev/null +++ b/packages/rollup-plugin/.gitignore @@ -0,0 +1,2 @@ +build +*.tgz diff --git a/packages/rollup-plugin/LICENSE b/packages/rollup-plugin/LICENSE new file mode 100644 index 000000000000..c23a90edc9be --- /dev/null +++ b/packages/rollup-plugin/LICENSE @@ -0,0 +1,29 @@ +# MIT License + +Copyright (c) 2022-2026, Sentry +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/rollup-plugin/README.md b/packages/rollup-plugin/README.md new file mode 100644 index 000000000000..17a8d1c7b2c2 --- /dev/null +++ b/packages/rollup-plugin/README.md @@ -0,0 +1,46 @@ +

+ + Sentry + +

+ +# Sentry Rollup Plugin + +A Rollup plugin that uploads source maps to Sentry and injects release and Debug ID information into your bundles. + +This package re-exports `@sentry/bundler-plugins/rollup`. + +## Installation + +```bash +npm install @sentry/rollup-plugin --save-dev +``` + +## Usage + +```js +// rollup.config.js +import { sentryRollupPlugin } from '@sentry/rollup-plugin'; + +export default { + output: { + sourcemap: true, + }, + plugins: [ + sentryRollupPlugin({ + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, + authToken: process.env.SENTRY_AUTH_TOKEN, + }), + ], +}; +``` + +## Documentation + +- [Uploading source maps](https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/) + +## Support + +- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose) +- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md) diff --git a/packages/rollup-plugin/package.json b/packages/rollup-plugin/package.json new file mode 100644 index 000000000000..22252d75e54f --- /dev/null +++ b/packages/rollup-plugin/package.json @@ -0,0 +1,65 @@ +{ + "name": "@sentry/rollup-plugin", + "version": "11.7.0", + "description": "Official Sentry Rollup plugin", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/develop/packages/rollup-plugin", + "author": "Sentry", + "license": "MIT", + "keywords": [ + "Sentry", + "rollup-plugin", + "Rollup", + "bundler", + "plugin" + ], + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "/build" + ], + "main": "build/cjs/index.js", + "module": "build/esm/index.js", + "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./build/types/index.d.ts", + "import": "./build/esm/index.js", + "require": "./build/cjs/index.js" + } + }, + "scripts": { + "build": "run-p build:transpile build:types", + "build:dev": "yarn build", + "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:types": "tsc -p tsconfig.types.json", + "build:watch": "run-p build:transpile:watch", + "build:dev:watch": "yarn build:watch", + "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:tarball": "npm pack", + "clean": "rimraf build coverage sentry-rollup-plugin-*.tgz", + "lint": "oxlint . --type-aware", + "lint:fix": "oxlint . --fix --type-aware", + "test": "vitest run", + "test:unit": "vitest run" + }, + "dependencies": { + "@sentry/bundler-plugins": "11.7.0" + }, + "peerDependencies": { + "rollup": ">=3.2.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + }, + "volta": { + "extends": "../../package.json" + } +} diff --git a/packages/rollup-plugin/rollup.npm.config.mjs b/packages/rollup-plugin/rollup.npm.config.mjs new file mode 100644 index 000000000000..601cc6837ce0 --- /dev/null +++ b/packages/rollup-plugin/rollup.npm.config.mjs @@ -0,0 +1,7 @@ +import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; + +export default makeNPMConfigVariants( + makeBaseNPMConfig({ + entrypoints: ['src/index.ts'], + }), +); diff --git a/packages/rollup-plugin/src/index.ts b/packages/rollup-plugin/src/index.ts new file mode 100644 index 000000000000..0807365d7f98 --- /dev/null +++ b/packages/rollup-plugin/src/index.ts @@ -0,0 +1 @@ +export * from '@sentry/bundler-plugins/rollup'; diff --git a/packages/rollup-plugin/test/index.test.ts b/packages/rollup-plugin/test/index.test.ts new file mode 100644 index 000000000000..759af8b27bb6 --- /dev/null +++ b/packages/rollup-plugin/test/index.test.ts @@ -0,0 +1,10 @@ +import * as bundlerPlugins from '@sentry/bundler-plugins/rollup'; +import { describe, expect, it } from 'vitest'; +import * as plugin from '../src/index'; + +describe('@sentry/rollup-plugin', () => { + it('re-exports @sentry/bundler-plugins/rollup', () => { + expect(plugin.sentryRollupPlugin).toBe(bundlerPlugins.sentryRollupPlugin); + expect(Object.keys(plugin).sort()).toEqual(Object.keys(bundlerPlugins).sort()); + }); +}); diff --git a/packages/rollup-plugin/test/tsconfig.json b/packages/rollup-plugin/test/tsconfig.json new file mode 100644 index 000000000000..76d0c9cff6f2 --- /dev/null +++ b/packages/rollup-plugin/test/tsconfig.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../tsconfig.json", + "include": ["../src/**/*", "./**/*"], + "compilerOptions": { + "types": ["node"] + } +} diff --git a/packages/rollup-plugin/tsconfig.json b/packages/rollup-plugin/tsconfig.json new file mode 100644 index 000000000000..2044e12308ea --- /dev/null +++ b/packages/rollup-plugin/tsconfig.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts", "./package.json"] +} diff --git a/packages/rollup-plugin/tsconfig.types.json b/packages/rollup-plugin/tsconfig.types.json new file mode 100644 index 000000000000..9321489cd9a9 --- /dev/null +++ b/packages/rollup-plugin/tsconfig.types.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "./tsconfig.json", + "include": ["./src/**/*"], + "compilerOptions": { + "rootDir": "./src", + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "build/types" + } +} diff --git a/packages/rollup-plugin/vite.config.ts b/packages/rollup-plugin/vite.config.ts new file mode 100644 index 000000000000..f18ec92095bc --- /dev/null +++ b/packages/rollup-plugin/vite.config.ts @@ -0,0 +1,8 @@ +import baseConfig from '../../vite/vite.config'; + +export default { + ...baseConfig, + test: { + ...baseConfig.test, + }, +}; diff --git a/packages/vite-plugin/.gitignore b/packages/vite-plugin/.gitignore new file mode 100644 index 000000000000..22cfeae206b4 --- /dev/null +++ b/packages/vite-plugin/.gitignore @@ -0,0 +1,2 @@ +build +*.tgz diff --git a/packages/vite-plugin/LICENSE b/packages/vite-plugin/LICENSE new file mode 100644 index 000000000000..c23a90edc9be --- /dev/null +++ b/packages/vite-plugin/LICENSE @@ -0,0 +1,29 @@ +# MIT License + +Copyright (c) 2022-2026, Sentry +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/vite-plugin/README.md b/packages/vite-plugin/README.md new file mode 100644 index 000000000000..95264132eb3b --- /dev/null +++ b/packages/vite-plugin/README.md @@ -0,0 +1,47 @@ +

+ + Sentry + +

+ +# Sentry Vite Plugin + +A Vite plugin that uploads source maps to Sentry and injects release and Debug ID information into your bundles. + +This package re-exports `@sentry/bundler-plugins/vite`. + +## Installation + +```bash +npm install @sentry/vite-plugin --save-dev +``` + +## Usage + +```js +// vite.config.js +import { defineConfig } from 'vite'; +import { sentryVitePlugin } from '@sentry/vite-plugin'; + +export default defineConfig({ + build: { + sourcemap: true, + }, + plugins: [ + sentryVitePlugin({ + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, + authToken: process.env.SENTRY_AUTH_TOKEN, + }), + ], +}); +``` + +## Documentation + +- [Uploading source maps](https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/) + +## Support + +- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose) +- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md) diff --git a/packages/vite-plugin/package.json b/packages/vite-plugin/package.json new file mode 100644 index 000000000000..c8fa6bf2f241 --- /dev/null +++ b/packages/vite-plugin/package.json @@ -0,0 +1,56 @@ +{ + "name": "@sentry/vite-plugin", + "version": "11.7.0", + "description": "Official Sentry Vite plugin", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/develop/packages/vite-plugin", + "author": "Sentry", + "license": "MIT", + "keywords": [ + "Sentry", + "Vite", + "bundler", + "plugin" + ], + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "/build" + ], + "main": "build/cjs/index.js", + "module": "build/esm/index.js", + "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./build/types/index.d.ts", + "import": "./build/esm/index.js", + "require": "./build/cjs/index.js" + } + }, + "scripts": { + "build": "run-p build:transpile build:types", + "build:dev": "yarn build", + "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:types": "tsc -p tsconfig.types.json", + "build:watch": "run-p build:transpile:watch", + "build:dev:watch": "yarn build:watch", + "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:tarball": "npm pack", + "clean": "rimraf build coverage sentry-vite-plugin-*.tgz", + "lint": "oxlint . --type-aware", + "lint:fix": "oxlint . --fix --type-aware", + "test": "vitest run", + "test:unit": "vitest run" + }, + "dependencies": { + "@sentry/bundler-plugins": "11.7.0" + }, + "volta": { + "extends": "../../package.json" + } +} diff --git a/packages/vite-plugin/rollup.npm.config.mjs b/packages/vite-plugin/rollup.npm.config.mjs new file mode 100644 index 000000000000..601cc6837ce0 --- /dev/null +++ b/packages/vite-plugin/rollup.npm.config.mjs @@ -0,0 +1,7 @@ +import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; + +export default makeNPMConfigVariants( + makeBaseNPMConfig({ + entrypoints: ['src/index.ts'], + }), +); diff --git a/packages/vite-plugin/src/index.ts b/packages/vite-plugin/src/index.ts new file mode 100644 index 000000000000..cc8533273401 --- /dev/null +++ b/packages/vite-plugin/src/index.ts @@ -0,0 +1 @@ +export * from '@sentry/bundler-plugins/vite'; diff --git a/packages/vite-plugin/test/index.test.ts b/packages/vite-plugin/test/index.test.ts new file mode 100644 index 000000000000..5cb1c33948c4 --- /dev/null +++ b/packages/vite-plugin/test/index.test.ts @@ -0,0 +1,10 @@ +import * as bundlerPlugins from '@sentry/bundler-plugins/vite'; +import { describe, expect, it } from 'vitest'; +import * as plugin from '../src/index'; + +describe('@sentry/vite-plugin', () => { + it('re-exports @sentry/bundler-plugins/vite', () => { + expect(plugin.sentryVitePlugin).toBe(bundlerPlugins.sentryVitePlugin); + expect(Object.keys(plugin).sort()).toEqual(Object.keys(bundlerPlugins).sort()); + }); +}); diff --git a/packages/vite-plugin/test/tsconfig.json b/packages/vite-plugin/test/tsconfig.json new file mode 100644 index 000000000000..76d0c9cff6f2 --- /dev/null +++ b/packages/vite-plugin/test/tsconfig.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../tsconfig.json", + "include": ["../src/**/*", "./**/*"], + "compilerOptions": { + "types": ["node"] + } +} diff --git a/packages/vite-plugin/tsconfig.json b/packages/vite-plugin/tsconfig.json new file mode 100644 index 000000000000..2044e12308ea --- /dev/null +++ b/packages/vite-plugin/tsconfig.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts", "./package.json"] +} diff --git a/packages/vite-plugin/tsconfig.types.json b/packages/vite-plugin/tsconfig.types.json new file mode 100644 index 000000000000..9321489cd9a9 --- /dev/null +++ b/packages/vite-plugin/tsconfig.types.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "./tsconfig.json", + "include": ["./src/**/*"], + "compilerOptions": { + "rootDir": "./src", + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "build/types" + } +} diff --git a/packages/vite-plugin/vite.config.ts b/packages/vite-plugin/vite.config.ts new file mode 100644 index 000000000000..f18ec92095bc --- /dev/null +++ b/packages/vite-plugin/vite.config.ts @@ -0,0 +1,8 @@ +import baseConfig from '../../vite/vite.config'; + +export default { + ...baseConfig, + test: { + ...baseConfig.test, + }, +}; diff --git a/packages/webpack-plugin/.gitignore b/packages/webpack-plugin/.gitignore new file mode 100644 index 000000000000..22cfeae206b4 --- /dev/null +++ b/packages/webpack-plugin/.gitignore @@ -0,0 +1,2 @@ +build +*.tgz diff --git a/packages/webpack-plugin/LICENSE b/packages/webpack-plugin/LICENSE new file mode 100644 index 000000000000..c23a90edc9be --- /dev/null +++ b/packages/webpack-plugin/LICENSE @@ -0,0 +1,29 @@ +# MIT License + +Copyright (c) 2022-2026, Sentry +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/webpack-plugin/README.md b/packages/webpack-plugin/README.md new file mode 100644 index 000000000000..035bc61567ae --- /dev/null +++ b/packages/webpack-plugin/README.md @@ -0,0 +1,44 @@ +

+ + Sentry + +

+ +# Sentry Webpack Plugin + +A Webpack plugin that uploads source maps to Sentry and injects release and Debug ID information into your bundles. + +This package re-exports `@sentry/bundler-plugins/webpack`. + +## Installation + +```bash +npm install @sentry/webpack-plugin --save-dev +``` + +## Usage + +```js +// webpack.config.js +const { sentryWebpackPlugin } = require('@sentry/webpack-plugin'); + +module.exports = { + devtool: 'source-map', + plugins: [ + sentryWebpackPlugin({ + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, + authToken: process.env.SENTRY_AUTH_TOKEN, + }), + ], +}; +``` + +## Documentation + +- [Uploading source maps](https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/) + +## Support + +- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose) +- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md) diff --git a/packages/webpack-plugin/package.json b/packages/webpack-plugin/package.json new file mode 100644 index 000000000000..639451d01134 --- /dev/null +++ b/packages/webpack-plugin/package.json @@ -0,0 +1,64 @@ +{ + "name": "@sentry/webpack-plugin", + "version": "11.7.0", + "description": "Official Sentry Webpack plugin", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/develop/packages/webpack-plugin", + "author": "Sentry", + "license": "MIT", + "keywords": [ + "Sentry", + "Webpack", + "bundler", + "plugin" + ], + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "/build" + ], + "main": "build/cjs/index.js", + "module": "build/esm/index.js", + "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./build/types/index.d.ts", + "import": "./build/esm/index.js", + "require": "./build/cjs/index.js" + }, + "./webpack5": { + "types": "./build/types/webpack5.d.ts", + "import": "./build/esm/webpack5.js", + "require": "./build/cjs/webpack5.js" + } + }, + "scripts": { + "build": "run-p build:transpile build:types", + "build:dev": "yarn build", + "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:types": "tsc -p tsconfig.types.json", + "build:watch": "run-p build:transpile:watch", + "build:dev:watch": "yarn build:watch", + "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:tarball": "npm pack", + "clean": "rimraf build coverage sentry-webpack-plugin-*.tgz", + "lint": "oxlint . --type-aware", + "lint:fix": "oxlint . --fix --type-aware", + "test": "vitest run", + "test:unit": "vitest run" + }, + "dependencies": { + "@sentry/bundler-plugins": "11.7.0" + }, + "peerDependencies": { + "webpack": ">=5.1.0" + }, + "volta": { + "extends": "../../package.json" + } +} diff --git a/packages/webpack-plugin/rollup.npm.config.mjs b/packages/webpack-plugin/rollup.npm.config.mjs new file mode 100644 index 000000000000..b4522dc9186d --- /dev/null +++ b/packages/webpack-plugin/rollup.npm.config.mjs @@ -0,0 +1,7 @@ +import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; + +export default makeNPMConfigVariants( + makeBaseNPMConfig({ + entrypoints: ['src/index.ts', 'src/webpack5.ts'], + }), +); diff --git a/packages/webpack-plugin/src/index.ts b/packages/webpack-plugin/src/index.ts new file mode 100644 index 000000000000..054e9f40a1f3 --- /dev/null +++ b/packages/webpack-plugin/src/index.ts @@ -0,0 +1 @@ +export * from '@sentry/bundler-plugins/webpack'; diff --git a/packages/webpack-plugin/src/webpack5.ts b/packages/webpack-plugin/src/webpack5.ts new file mode 100644 index 000000000000..054e9f40a1f3 --- /dev/null +++ b/packages/webpack-plugin/src/webpack5.ts @@ -0,0 +1 @@ +export * from '@sentry/bundler-plugins/webpack'; diff --git a/packages/webpack-plugin/test/index.test.ts b/packages/webpack-plugin/test/index.test.ts new file mode 100644 index 000000000000..6a542d367dab --- /dev/null +++ b/packages/webpack-plugin/test/index.test.ts @@ -0,0 +1,15 @@ +import * as bundlerPlugins from '@sentry/bundler-plugins/webpack'; +import { describe, expect, it } from 'vitest'; +import * as plugin from '../src/index'; + +describe('@sentry/webpack-plugin', () => { + it('re-exports @sentry/bundler-plugins/webpack', () => { + expect(plugin.sentryWebpackPlugin).toBe(bundlerPlugins.sentryWebpackPlugin); + expect(Object.keys(plugin).sort()).toEqual(Object.keys(bundlerPlugins).sort()); + }); + + it('re-exports the plugin from ./webpack5', async () => { + const webpack5 = await import('../src/webpack5'); + expect(webpack5.sentryWebpackPlugin).toBe(bundlerPlugins.sentryWebpackPlugin); + }); +}); diff --git a/packages/webpack-plugin/test/tsconfig.json b/packages/webpack-plugin/test/tsconfig.json new file mode 100644 index 000000000000..76d0c9cff6f2 --- /dev/null +++ b/packages/webpack-plugin/test/tsconfig.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../tsconfig.json", + "include": ["../src/**/*", "./**/*"], + "compilerOptions": { + "types": ["node"] + } +} diff --git a/packages/webpack-plugin/tsconfig.json b/packages/webpack-plugin/tsconfig.json new file mode 100644 index 000000000000..2044e12308ea --- /dev/null +++ b/packages/webpack-plugin/tsconfig.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../../tsconfig.json", + "include": ["./src/**/*.ts", "./package.json"] +} diff --git a/packages/webpack-plugin/tsconfig.types.json b/packages/webpack-plugin/tsconfig.types.json new file mode 100644 index 000000000000..9321489cd9a9 --- /dev/null +++ b/packages/webpack-plugin/tsconfig.types.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "./tsconfig.json", + "include": ["./src/**/*"], + "compilerOptions": { + "rootDir": "./src", + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "build/types" + } +} diff --git a/packages/webpack-plugin/vite.config.ts b/packages/webpack-plugin/vite.config.ts new file mode 100644 index 000000000000..f18ec92095bc --- /dev/null +++ b/packages/webpack-plugin/vite.config.ts @@ -0,0 +1,8 @@ +import baseConfig from '../../vite/vite.config'; + +export default { + ...baseConfig, + test: { + ...baseConfig.test, + }, +};