@sentry/webpack-plugin 1.20.1 → 2.0.0-alpha.5
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/LICENSE +25 -17
- package/README.md +97 -92
- package/dist/cjs/index.js +72 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.mjs +65 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +68 -41
- package/.craft.yml +0 -13
- package/.eslintrc +0 -6
- package/.prettierrc +0 -6
- package/CHANGELOG.md +0 -202
- package/index.d.ts +0 -149
- package/jest.config.js +0 -5
- package/scripts/craft-pre-release.sh +0 -8
- package/src/cjs.js +0 -20
- package/src/index.js +0 -596
- package/src/sentry-webpack.module.js +0 -1
- package/src/sentry.loader.js +0 -15
package/LICENSE
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2022, Sentry
|
|
4
|
+
All rights reserved.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
- Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
- Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
- Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -6,21 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
# Sentry Webpack Plugin
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[](https://www.npmjs.com/package/@sentry/webpack-plugin)
|
|
11
|
-
[](https://www.npmjs.com/package/@sentry/webpack-plugin)
|
|
12
|
-
[](https://www.npmjs.com/package/@sentry/webpack-plugin)
|
|
9
|
+
A Webpack plugin that provides release management features for Sentry:
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
- Sourcemap upload
|
|
12
|
+
- Release creation
|
|
13
|
+
- Automatic release name discovery (based on CI environment - Vercel, AWS, Heroku, CircleCI, or current Git SHA)
|
|
14
|
+
- Automatically association of errors with releases (Release injection)
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
[Sentry CLI](https://docs.sentry.io/learn/cli/).
|
|
20
|
-
|
|
21
|
-
### Installation
|
|
22
|
-
|
|
23
|
-
`@sentry/webpack-plugin` requires at least `webpack@4.41.31` or any `webpack@5` version to be installed.
|
|
16
|
+
## Installation
|
|
24
17
|
|
|
25
18
|
Using npm:
|
|
26
19
|
|
|
@@ -34,100 +27,104 @@ Using yarn:
|
|
|
34
27
|
$ yarn add @sentry/webpack-plugin --dev
|
|
35
28
|
```
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
You can use either `.sentryclirc` file or ENV variables described here
|
|
40
|
-
https://docs.sentry.io/cli/configuration.
|
|
41
|
-
|
|
42
|
-
### Usage
|
|
30
|
+
## Usage
|
|
43
31
|
|
|
44
32
|
```js
|
|
45
|
-
|
|
33
|
+
// webpack.config.js
|
|
34
|
+
const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");
|
|
46
35
|
|
|
47
|
-
|
|
36
|
+
module.exports = {
|
|
48
37
|
plugins: [
|
|
49
|
-
|
|
50
|
-
include:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
sentryWebpackPlugin({
|
|
39
|
+
include: ".",
|
|
40
|
+
ignore: ["node_modules", "webpack.config.js"],
|
|
41
|
+
org: process.env.SENTRY_ORG,
|
|
42
|
+
project: process.env.SENTRY_PROJECT,
|
|
43
|
+
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
54
44
|
}),
|
|
55
45
|
],
|
|
56
46
|
};
|
|
57
47
|
```
|
|
58
48
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
49
|
+
As an alternative to passing options explicitly, you can also use a `.sentryclirc` file or environment variables as described in https://docs.sentry.io/product/cli/configuration/.
|
|
50
|
+
|
|
51
|
+
### Configuration
|
|
52
|
+
|
|
53
|
+
The Sentry Webpack Plugin takes an options argument with the following properties:
|
|
54
|
+
|
|
55
|
+
| Option | Type | Required | Description |
|
|
56
|
+
| ------------------------------------ | -------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
57
|
+
| org | `string` | optional | The slug of the Sentry organization associated with the app. Can also be specified via the `SENTRY_ORG` environment variable. |
|
|
58
|
+
| project | `string` | optional | The slug of the Sentry project associated with the app. Can also be specified via the `SENTRY_PROJECT` environment variable. |
|
|
59
|
+
| authToken | `string` | optional | The authentication token to use for all communication with Sentry. Can be obtained from https://sentry.io/settings/account/api/auth-tokens/. Required scopes: `project:releases` (and `org:read` if `setCommits` option is used). Can also be specified via the `SENTRY_AUTH_TOKEN` env variable. |
|
|
60
|
+
| sourcemaps.assets | string \| string[] | optional | A glob or an array of globs that specify the build artifacts that should be uploaded to Sentry. Leave this option undefined if you do not want to upload source maps to Sentry. The globbing patterns follow the implementation of the [`glob`](https://www.npmjs.com/package/glob) package. Use the `debug` option to print information about which files end up being uploaded. |
|
|
61
|
+
| sourcemaps.ignore | string \| string[] | optional | A glob or an array of globs that specify which build artifacts should not be uploaded to Sentry. The globbing patterns follow the implementation of the [`glob`](https://www.npmjs.com/package/glob) package. Use the `debug` option to print information about which files end up being uploaded. Default: `[]` |
|
|
62
|
+
| url | `string` | optional | The base URL of your Sentry instance. Use this if you are using a self-hosted or Sentry instance other than sentry.io. This value can also be set via the `SENTRY_URL` environment variable. Defaults to https://sentry.io/, which is the correct value for SaaS customers. |
|
|
63
|
+
| headers | `Record<string, string>` | optional | Headers added to every outgoing network request. |
|
|
64
|
+
| vcsRemote | `string` | optional | Version control system remote name. This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable. Defaults to `'origin'`. |
|
|
65
|
+
| release | `string` | optional | Unique identifier for the release. This value can also be specified via the `SENTRY_RELEASE` environment variable. Defaults to the output of the `sentry-cli releases propose-version` command, which automatically detects values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA. (**the latter requires access to `git` CLI and for the root directory to be a valid repository**). |
|
|
66
|
+
| dist | `string` | optional | Unique identifier for the distribution, used to further segment your release. Usually your build number. |
|
|
67
|
+
| releaseInjectionTargets | `array`/`RegExp`/`(string \| RegExp)[]`/`function(filePath: string): bool` | optional | Filter for modules that the release should be injected in. This option takes a string, a regular expression, or an array containing strings, regular expressions, or both. It's also possible to provide a filter function that takes the absolute path of a processed module. It should return `true` if the release should be injected into the module and `false` otherwise. String values of this option require a full match with the absolute path of the module. By default, the release will be injected into all modules - however, bundlers will include the injected release code only once per entrypoint. If release injection should be disabled, provide an empty array here. |
|
|
68
|
+
| ignoreFile | `string` | optional | Path to a file containing list of files/directories to ignore. Can point to `.gitignore` or anything with the same format. |
|
|
69
|
+
| ignore | `string`/`array` | optional | One or more paths to ignore during upload. Overrides entries in `ignoreFile` file. Defaults to `['node_modules']` if neither `ignoreFile` nor `ignore` is set. |
|
|
70
|
+
| configFile | `string` | optional | Path to Sentry CLI config properties, as described in https://docs.sentry.io/product/cli/configuration/#configuration-file. By default, the config file is looked for upwards from the current path, and defaults from `~/.sentryclirc` are always loaded. |
|
|
71
|
+
| ext | `array` | optional | Array of file extensions of files to be collected for the file upload. By default the following file extensions are processed: js, map, jsbundle and bundle. |
|
|
72
|
+
| urlPrefix | `string` | optional | URL prefix to add to the beginning of all filenames. Defaults to `'~/'` but you might want to set this to the full URL. This is also useful if your files are stored in a sub folder. eg: url-prefix `'~/static/js'`. |
|
|
73
|
+
| urlSuffix | `string` | optional | URL suffix to add to the end of all filenames. Useful for appending query parameters. |
|
|
74
|
+
| validate | `boolean` | optional | When `true`, attempts source map validation before upload if rewriting is not enabled. It will spot a variety of issues with source maps and cancel the upload if any are found. Defaults to `false` as this can cause false positives. |
|
|
75
|
+
| stripPrefix | `array` | optional | When paired with the `rewrite` option, this will remove a prefix from filename references inside of sourcemaps. For instance you can use this to remove a path that is build machine specific. Note that this will NOT change the names of uploaded files. |
|
|
76
|
+
| stripCommonPrefix | `boolean` | optional | When paired with the `rewrite` option, this will add `~` to the `stripPrefix` array. |
|
|
77
|
+
| sourceMapReference | `boolean` | optional | Determines whether sentry-cli should attempt to link minified files with their corresponding maps. By default, it will match files and maps based on name, and add a Sourcemap header to each minified file for which it finds a map. Can be disabled if all minified files contain a `sourceMappingURL`. Defaults to `true`. |
|
|
78
|
+
| rewrite | `boolean` | optional | Enables rewriting of matching source maps so that indexed maps are flattened and missing sources are inlined if possible. Defaults to `true` |
|
|
79
|
+
| finalize | `boolean` | optional | Determines if the Sentry release record should be automatically finalized (meaning a date_released timestamp is added) after artifact upload. Defaults to `true`. |
|
|
80
|
+
| dryRun | `boolean` | optional | Attempts a dry run (useful for dev environments), making release creation a no-op. Defaults to `false`. |
|
|
81
|
+
| debug | `boolean` | optional | Print useful debug information. Defaults to `false`. |
|
|
82
|
+
| silent | `boolean` | optional | Suppresses all logs. Defaults to `false`. |
|
|
83
|
+
| cleanArtifacts | `boolean` | optional | Remove all the artifacts in the release before the upload. Defaults to `false`. |
|
|
84
|
+
| errorHandler | `function(err: Error): void` | optional | When an error occurs during release creation or sourcemaps upload, the plugin will call this function. By default, the plugin will simply throw an error, thereby stopping the bundling process. If an `errorHandler` callback is provided, compilation will continue, unless an error is thrown in the provided callback. |
|
|
85
|
+
| setCommits | `Object` | optional | Associates the release with its commits in Sentry. See [table below](#setCommits) for details. |
|
|
86
|
+
| deploy | `Object` | optional | Adds deployment information to the release in Sentry. See [table below](#deploy) for details. |
|
|
87
|
+
| injectRelease | `boolean` | optional | Whether the plugin should inject release information into the build. Defaults to `true`. |
|
|
88
|
+
| uploadSourceMaps | `boolean` | optional | Whether the plugin should upload source maps to Sentry. Defaults to `true`. |
|
|
89
|
+
| telemetry | `boolean` | optional | If set to true, internal plugin errors and performance data will be sent to Sentry. At Sentry we like to use Sentry ourselves to deliver faster and more stable products. We're very careful of what we're sending. We won't collect anything other than error and high-level performance data. We will never collect your code or any details of the projects in which you're using this plugin. Defaults to `true`. |
|
|
90
|
+
| include | `string`/`array`/`object` | required | One or more paths that the plugin should scan recursively for sources. It will upload all `.map` files and match associated `.js` files. Other file types can be uploaded by using the `ext` option. Each path can be given as a string or an object with path-specific options. See [table below](#include) for details. (Note: This option is deprecated. Please use the `sourcemap` option instead) |
|
|
91
|
+
| \_experiments.injectBuildInformation | `boolean` | optional | If set to true, the plugin will inject an additional `SENTRY_BUILD_INFO` variable that contains information about the build that can be used to improve SDK functionality. Defaults to `false`. |
|
|
94
92
|
|
|
95
93
|
#### <a name="include"></a>options.include:
|
|
96
94
|
|
|
97
|
-
| Option | Type
|
|
98
|
-
| ------------------ |
|
|
99
|
-
| paths | `
|
|
100
|
-
| ignoreFile | `string`
|
|
101
|
-
| ignore | `string`/`
|
|
102
|
-
| ext | `array`
|
|
103
|
-
| urlPrefix | `string`
|
|
104
|
-
| urlSuffix | `string`
|
|
105
|
-
| stripPrefix | `array`
|
|
106
|
-
| stripCommonPrefix | `boolean`
|
|
107
|
-
| sourceMapReference | `boolean`
|
|
108
|
-
| rewrite | `boolean`
|
|
95
|
+
| Option | Type | Required | Description |
|
|
96
|
+
| ------------------ | ------------------- | -------- | ---------------------------------------------- |
|
|
97
|
+
| paths | `string[]` | required | One or more paths to scan for files to upload. |
|
|
98
|
+
| ignoreFile | `string` | optional | See above. |
|
|
99
|
+
| ignore | `string`/`string[]` | optional | See above. |
|
|
100
|
+
| ext | `array` | optional | See above. |
|
|
101
|
+
| urlPrefix | `string` | optional | See above. |
|
|
102
|
+
| urlSuffix | `string` | optional | See above. |
|
|
103
|
+
| stripPrefix | `array` | optional | See above. |
|
|
104
|
+
| stripCommonPrefix | `boolean` | optional | See above. |
|
|
105
|
+
| sourceMapReference | `boolean` | optional | See above. |
|
|
106
|
+
| rewrite | `boolean` | optional | See above. |
|
|
109
107
|
|
|
110
108
|
Example:
|
|
111
109
|
|
|
112
110
|
```js
|
|
113
|
-
|
|
111
|
+
// webpack.config.js
|
|
112
|
+
const sentryWebpackPlugin = require("@sentry/webpack-plugin");
|
|
114
113
|
|
|
115
|
-
|
|
114
|
+
module.exports = {
|
|
116
115
|
plugins: [
|
|
117
|
-
|
|
116
|
+
sentryWebpackPlugin({
|
|
117
|
+
// ...
|
|
118
118
|
include: [
|
|
119
119
|
{
|
|
120
|
-
paths: [
|
|
121
|
-
urlPrefix:
|
|
120
|
+
paths: ["./packages"],
|
|
121
|
+
urlPrefix: "~/path/to/packages",
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
|
-
paths: [
|
|
125
|
-
urlPrefix:
|
|
124
|
+
paths: ["./client"],
|
|
125
|
+
urlPrefix: "~/path/to/client",
|
|
126
126
|
},
|
|
127
127
|
],
|
|
128
|
-
ignoreFile: '.sentrycliignore',
|
|
129
|
-
ignore: ['node_modules', 'webpack.config.js'],
|
|
130
|
-
configFile: 'sentry.properties',
|
|
131
128
|
}),
|
|
132
129
|
],
|
|
133
130
|
};
|
|
@@ -135,24 +132,32 @@ const config = {
|
|
|
135
132
|
|
|
136
133
|
#### <a name="setCommits"></a>options.setCommits:
|
|
137
134
|
|
|
138
|
-
| Option | Type | Required | Description
|
|
139
|
-
| -------------- | --------- | --------- |
|
|
140
|
-
| repo | `string` | see notes | The full git repo name as defined in Sentry. Required if `auto` option is not `true`, otherwise optional.
|
|
141
|
-
| commit | `string` | see notes | The current (most recent) commit in the release. Required if `auto` option is not `true`, otherwise optional.
|
|
142
|
-
| previousCommit | `string` | optional | The last commit of the previous release. Defaults to the
|
|
143
|
-
| auto | `boolean` | optional | Automatically
|
|
144
|
-
| ignoreMissing | `boolean` | optional |
|
|
135
|
+
| Option | Type | Required | Description |
|
|
136
|
+
| -------------- | --------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
137
|
+
| repo | `string` | see notes | The full git repo name as defined in Sentry. Required if the `auto` option is not `true`, otherwise optional. |
|
|
138
|
+
| commit | `string` | see notes | The current (most recent) commit in the release. Required if the `auto` option is not `true`, otherwise optional. |
|
|
139
|
+
| previousCommit | `string` | optional | The commit before the beginning of this release (in other words, the last commit of the previous release). Defaults to the last commit of the previous release in Sentry. If there was no previous release, the last 10 commits will be used. |
|
|
140
|
+
| auto | `boolean` | optional | Automatically sets `commit` and `previousCommit`. Sets `commit` to `HEAD` and `previousCommit` as described in the option's documentation. If you set this to `true`, manually specified `commit` and `previousCommit` options will be overridden. It is best to not specify them at all if you set this option to `true`. |
|
|
141
|
+
| ignoreMissing | `boolean` | optional | If the flag is to `true` and the previous release commit was not found in the repository, the plugin creates a release with the default commits count instead of failing the command. Defaults to `false`. |
|
|
145
142
|
|
|
146
143
|
#### <a name="deploy"></a>options.deploy:
|
|
147
144
|
|
|
148
145
|
| Option | Type | Required | Description |
|
|
149
146
|
| -------- | -------- | -------- | -------------------------------------------------------------------------------- |
|
|
150
147
|
| env | `string` | required | Environment value for the release, for example `production` or `staging`. |
|
|
151
|
-
| started | `number` | optional |
|
|
152
|
-
| finished | `number` | optional |
|
|
148
|
+
| started | `number` | optional | Deployment start time in Unix timestamp (in seconds) or ISO 8601 format. |
|
|
149
|
+
| finished | `number` | optional | Deployment finish time in Unix timestamp (in seconds) or ISO 8601 format. |
|
|
153
150
|
| time | `number` | optional | Deployment duration in seconds. Can be used instead of `started` and `finished`. |
|
|
154
151
|
| name | `string` | optional | Human-readable name for this deployment. |
|
|
155
152
|
| url | `string` | optional | URL that points to the deployment. |
|
|
156
153
|
|
|
157
154
|
You can find more information about these options in our official docs:
|
|
158
155
|
https://docs.sentry.io/product/cli/releases/#sentry-cli-sourcemaps.
|
|
156
|
+
|
|
157
|
+
## More information
|
|
158
|
+
|
|
159
|
+
- [Sentry Documentation](https://docs.sentry.io/quickstart/)
|
|
160
|
+
- [Troubleshooting Sourcemaps](https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/)
|
|
161
|
+
- [Sentry CLI](https://docs.sentry.io/learn/cli/)
|
|
162
|
+
- [Sentry Discord](https://discord.gg/Ww9hbqr)
|
|
163
|
+
- [Sentry Stackoverflow](http://stackoverflow.com/questions/tagged/sentry)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var bundlerPluginCore = require('@sentry/bundler-plugin-core');
|
|
6
|
+
var uuid = require('uuid');
|
|
7
|
+
var webpack4 = require('webpack-4');
|
|
8
|
+
|
|
9
|
+
function webpackReleaseInjectionPlugin(injectionCode) {
|
|
10
|
+
var pluginName = "sentry-webpack-release-injection-plugin";
|
|
11
|
+
return {
|
|
12
|
+
name: pluginName,
|
|
13
|
+
webpack: function webpack(compiler) {
|
|
14
|
+
var _compiler$webpack;
|
|
15
|
+
|
|
16
|
+
if (compiler !== null && compiler !== void 0 && (_compiler$webpack = compiler.webpack) !== null && _compiler$webpack !== void 0 && _compiler$webpack.BannerPlugin) {
|
|
17
|
+
compiler.options.plugins.push(new compiler.webpack.BannerPlugin({
|
|
18
|
+
raw: true,
|
|
19
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
|
|
20
|
+
banner: injectionCode
|
|
21
|
+
}));
|
|
22
|
+
} else {
|
|
23
|
+
compiler.options.plugins.push( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
24
|
+
new webpack4.BannerPlugin({
|
|
25
|
+
raw: true,
|
|
26
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
|
|
27
|
+
banner: injectionCode
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function webpackDebugIdInjectionPlugin() {
|
|
35
|
+
var pluginName = "sentry-webpack-debug-id-injection-plugin";
|
|
36
|
+
var debugIdSnippet = bundlerPluginCore.getDebugIdSnippet(uuid.v4());
|
|
37
|
+
return {
|
|
38
|
+
name: pluginName,
|
|
39
|
+
webpack: function webpack(compiler) {
|
|
40
|
+
var _compiler$webpack2;
|
|
41
|
+
|
|
42
|
+
if (compiler !== null && compiler !== void 0 && (_compiler$webpack2 = compiler.webpack) !== null && _compiler$webpack2 !== void 0 && _compiler$webpack2.BannerPlugin) {
|
|
43
|
+
compiler.options.plugins.push(new compiler.webpack.BannerPlugin({
|
|
44
|
+
raw: true,
|
|
45
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
|
|
46
|
+
banner: debugIdSnippet
|
|
47
|
+
}));
|
|
48
|
+
} else {
|
|
49
|
+
compiler.options.plugins.push( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
50
|
+
new webpack4.BannerPlugin({
|
|
51
|
+
raw: true,
|
|
52
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
|
|
53
|
+
banner: debugIdSnippet
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var sentryUnplugin = bundlerPluginCore.sentryUnpluginFactory({
|
|
61
|
+
releaseInjectionPlugin: webpackReleaseInjectionPlugin,
|
|
62
|
+
debugIdInjectionPlugin: webpackDebugIdInjectionPlugin
|
|
63
|
+
}); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
+
|
|
65
|
+
var sentryWebpackPlugin = sentryUnplugin.webpack;
|
|
66
|
+
|
|
67
|
+
Object.defineProperty(exports, 'sentryCliBinaryExists', {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () { return bundlerPluginCore.sentryCliBinaryExists; }
|
|
70
|
+
});
|
|
71
|
+
exports.sentryWebpackPlugin = sentryWebpackPlugin;
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { getDebugIdSnippet, Options, sentryUnpluginFactory } from \"@sentry/bundler-plugin-core\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore No typedefs for webpack 4\nimport { BannerPlugin as Webpack4BannerPlugin } from \"webpack-4\";\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n const pluginName = \"sentry-webpack-release-injection-plugin\";\n\n return {\n name: pluginName,\n\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n }\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-injection-plugin\";\n const debugIdSnippet = getDebugIdSnippet(uuidv4());\n\n return {\n name: pluginName,\n\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: debugIdSnippet,\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: debugIdSnippet,\n })\n );\n }\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options: Options) => any = sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\nexport type { Options as SentryWebpackPluginOptions } from \"@sentry/bundler-plugin-core\";\n"],"names":["webpackReleaseInjectionPlugin","injectionCode","pluginName","name","webpack","compiler","BannerPlugin","options","plugins","push","raw","include","banner","Webpack4BannerPlugin","webpackDebugIdInjectionPlugin","debugIdSnippet","getDebugIdSnippet","uuidv4","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","sentryWebpackPlugin"],"mappings":";;;;;;;;AAQA,SAASA,6BAAT,CAAuCC,aAAvC,EAA+E;EAC7E,IAAMC,UAAU,GAAG,yCAAnB,CAAA;EAEA,OAAO;AACLC,IAAAA,IAAI,EAAED,UADD;IAGLE,OAHK,EAAA,SAAA,OAAA,CAGGC,QAHH,EAGa;AAAA,MAAA,IAAA,iBA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ACnCD,QAAAA,QAAQ,CAACE,OAAT,CAAiBC,OAAjB,CAAyBC,IAAzB,CACE,IAAIJ,QAAQ,CAACD,OAAT,CAAiBE,YAArB,CAAkC;AAChCI,UAAAA,GAAG,EAAE,IAD2B;AAEhCC,UAAAA,OAAO,EAAE,4BAFuB;AAGhCC,UAAAA,MAAM,EAAEG,cAAAA;AAHwB,SAAlC,CADF,CAAA,CAAA;AAOD,OARD,MAQO;AACLV,QAAAA,QAAQ,CAACE,OAAT,CAAiBC,OAAjB,CAAyBC,IAAzB;AAEE,QAAA,IAAII,qBAAJ,CAAyB;AACvBH,UAAAA,GAAG,EAAE,IADkB;AAEvBC,UAAAA,OAAO,EAAE,4BAFc;AAGvBC,UAAAA,MAAM,EAAEG,cAAAA;AAHe,SAAzB,CAFF,CAAA,CAAA;AAQD,OAAA;AACF,KAAA;GAtBH,CAAA;AAwBD,CAAA;;AAED,IAAMG,cAAc,GAAGC,uCAAqB,CAAC;AAC3CC,EAAAA,sBAAsB,EAAEpB,6BADmB;AAE3CqB,EAAAA,sBAAsB,EAAEP,6BAAAA;AAFmB,CAAD,CAA5C;;AAMaQ,IAAAA,mBAA8C,GAAGJ,cAAc,CAACd;;;;;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { sentryUnpluginFactory, getDebugIdSnippet } from '@sentry/bundler-plugin-core';
|
|
2
|
+
export { sentryCliBinaryExists } from '@sentry/bundler-plugin-core';
|
|
3
|
+
import { v4 } from 'uuid';
|
|
4
|
+
import { BannerPlugin } from 'webpack-4';
|
|
5
|
+
|
|
6
|
+
function webpackReleaseInjectionPlugin(injectionCode) {
|
|
7
|
+
var pluginName = "sentry-webpack-release-injection-plugin";
|
|
8
|
+
return {
|
|
9
|
+
name: pluginName,
|
|
10
|
+
webpack: function webpack(compiler) {
|
|
11
|
+
var _compiler$webpack;
|
|
12
|
+
|
|
13
|
+
if (compiler !== null && compiler !== void 0 && (_compiler$webpack = compiler.webpack) !== null && _compiler$webpack !== void 0 && _compiler$webpack.BannerPlugin) {
|
|
14
|
+
compiler.options.plugins.push(new compiler.webpack.BannerPlugin({
|
|
15
|
+
raw: true,
|
|
16
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
|
|
17
|
+
banner: injectionCode
|
|
18
|
+
}));
|
|
19
|
+
} else {
|
|
20
|
+
compiler.options.plugins.push( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
21
|
+
new BannerPlugin({
|
|
22
|
+
raw: true,
|
|
23
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
|
|
24
|
+
banner: injectionCode
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function webpackDebugIdInjectionPlugin() {
|
|
32
|
+
var pluginName = "sentry-webpack-debug-id-injection-plugin";
|
|
33
|
+
var debugIdSnippet = getDebugIdSnippet(v4());
|
|
34
|
+
return {
|
|
35
|
+
name: pluginName,
|
|
36
|
+
webpack: function webpack(compiler) {
|
|
37
|
+
var _compiler$webpack2;
|
|
38
|
+
|
|
39
|
+
if (compiler !== null && compiler !== void 0 && (_compiler$webpack2 = compiler.webpack) !== null && _compiler$webpack2 !== void 0 && _compiler$webpack2.BannerPlugin) {
|
|
40
|
+
compiler.options.plugins.push(new compiler.webpack.BannerPlugin({
|
|
41
|
+
raw: true,
|
|
42
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
|
|
43
|
+
banner: debugIdSnippet
|
|
44
|
+
}));
|
|
45
|
+
} else {
|
|
46
|
+
compiler.options.plugins.push( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
47
|
+
new BannerPlugin({
|
|
48
|
+
raw: true,
|
|
49
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
|
|
50
|
+
banner: debugIdSnippet
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var sentryUnplugin = sentryUnpluginFactory({
|
|
58
|
+
releaseInjectionPlugin: webpackReleaseInjectionPlugin,
|
|
59
|
+
debugIdInjectionPlugin: webpackDebugIdInjectionPlugin
|
|
60
|
+
}); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
+
|
|
62
|
+
var sentryWebpackPlugin = sentryUnplugin.webpack;
|
|
63
|
+
|
|
64
|
+
export { sentryWebpackPlugin };
|
|
65
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import { getDebugIdSnippet, Options, sentryUnpluginFactory } from \"@sentry/bundler-plugin-core\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore No typedefs for webpack 4\nimport { BannerPlugin as Webpack4BannerPlugin } from \"webpack-4\";\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n const pluginName = \"sentry-webpack-release-injection-plugin\";\n\n return {\n name: pluginName,\n\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n }\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-injection-plugin\";\n const debugIdSnippet = getDebugIdSnippet(uuidv4());\n\n return {\n name: pluginName,\n\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: debugIdSnippet,\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: debugIdSnippet,\n })\n );\n }\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options: Options) => any = sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\nexport type { Options as SentryWebpackPluginOptions } from \"@sentry/bundler-plugin-core\";\n"],"names":["webpackReleaseInjectionPlugin","injectionCode","pluginName","name","webpack","compiler","BannerPlugin","options","plugins","push","raw","include","banner","Webpack4BannerPlugin","webpackDebugIdInjectionPlugin","debugIdSnippet","getDebugIdSnippet","uuidv4","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","sentryWebpackPlugin"],"mappings":";;;;;AAQA,SAASA,6BAAT,CAAuCC,aAAvC,EAA+E;EAC7E,IAAMC,UAAU,GAAG,yCAAnB,CAAA;EAEA,OAAO;AACLC,IAAAA,IAAI,EAAED,UADD;IAGLE,OAHK,EAAA,SAAA,OAAA,CAGGC,QAHH,EAGa;AAAA,MAAA,IAAA,iBAAA,CAAA;;MAChB,IAAIA,QAAJ,KAAIA,IAAAA,IAAAA,QAAJ,KAAIA,KAAAA,CAAAA,IAAAA,CAAAA,iBAAAA,GAAAA,QAAQ,CAAED,OAAd,MAAA,IAAA,IAAA,iBAAA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CC,UAAAA,OAAO,EAAE,4BAFuB;AAGhCC,UAAAA,MAAM,EAAEG,cAAAA;AAHwB,SAAlC,CADF,CAAA,CAAA;AAOD,OARD,MAQO;AACLV,QAAAA,QAAQ,CAACE,OAAT,CAAiBC,OAAjB,CAAyBC,IAAzB;AAEE,QAAA,IAAII,YAAJ,CAAyB;AACvBH,UAAAA,GAAG,EAAE,IADkB;AAEvBC,UAAAA,OAAO,EAAE,4BAFc;AAGvBC,UAAAA,MAAM,EAAEG,cAAAA;AAHe,SAAzB,CAFF,CAAA,CAAA;AAQD,OAAA;AACF,KAAA;GAtBH,CAAA;AAwBD,CAAA;;AAED,IAAMG,cAAc,GAAGC,qBAAqB,CAAC;AAC3CC,EAAAA,sBAAsB,EAAEpB,6BADmB;AAE3CqB,EAAAA,sBAAsB,EAAEP,6BAAAA;AAFmB,CAAD,CAA5C;;AAMaQ,IAAAA,mBAA8C,GAAGJ,cAAc,CAACd;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Options } from "@sentry/bundler-plugin-core";
|
|
2
|
+
export declare const sentryWebpackPlugin: (options: Options) => any;
|
|
3
|
+
export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core";
|
|
4
|
+
export type { Options as SentryWebpackPluginOptions } from "@sentry/bundler-plugin-core";
|