@sentry/webpack-plugin 1.18.9 → 1.19.1
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/CHANGELOG.md +11 -9
- package/README.md +34 -8
- package/package.json +3 -2
- package/src/index.js +13 -16
package/CHANGELOG.md
CHANGED
|
@@ -2,29 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
- "Would I rather be feared or loved? Easy. Both. I want people to be afraid of how much they love me." — Michael Scott
|
|
4
4
|
|
|
5
|
-
## 1.
|
|
5
|
+
## 1.19.1
|
|
6
|
+
|
|
7
|
+
- fix(deps): Add `webpack-sources` dependency (#397)
|
|
8
|
+
|
|
9
|
+
## 1.19.0
|
|
10
|
+
|
|
11
|
+
- feat(config): Support reading release from environment (#389)
|
|
12
|
+
- docs: Add example to `options.include` (#384)
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
## 1.18.9
|
|
8
15
|
|
|
9
|
-
- ref: Update sentry-cli and refresh GH actions (#368) by @kamilogorek
|
|
16
|
+
- ref: Update sentry-cli to latest v1 version and refresh GH actions (#368) by @kamilogorek
|
|
10
17
|
- docs: Update dryRun documentation to reflect auto-configuration. (#366) by @fiveable-jferg
|
|
11
|
-
- chore: update @sentry/cli to latest major version (#363) by @sawilde
|
|
12
18
|
|
|
13
19
|
## 1.18.8
|
|
14
20
|
|
|
15
|
-
### Various fixes & improvements
|
|
16
|
-
|
|
17
21
|
- deps: Bump sentry-cli to 1.73.0 (#356) by @kamilogorek
|
|
18
22
|
|
|
19
23
|
## 1.18.7
|
|
20
24
|
|
|
21
|
-
### Various fixes & improvements
|
|
22
|
-
|
|
23
25
|
- deps: Remove webpack from peerDep and move info about ver to readme (#354) by @kamilogorek
|
|
24
26
|
- misc: Correct 1.18.6 changelog (#353) by @kamilogorek
|
|
25
27
|
|
|
26
28
|
## 1.18.6
|
|
27
|
-
|
|
29
|
+
|
|
28
30
|
- ci: Change changelogPolicy to auto for Craft releases (#351)
|
|
29
31
|
- deps: Mark Webpack as optional peerDependency via peerDependenciesMeta ( #350)
|
|
30
32
|
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<br/>
|
|
6
|
-
<h1>Sentry Webpack Plugin</h1>
|
|
2
|
+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
|
|
3
|
+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
|
|
4
|
+
</a>
|
|
7
5
|
</p>
|
|
8
6
|
|
|
7
|
+
# Sentry Webpack Plugin
|
|
8
|
+
|
|
9
9
|
[](https://codecov.io/gh/getsentry/sentry-webpack-plugin)
|
|
10
10
|
[](https://www.npmjs.com/package/@sentry/webpack-plugin)
|
|
11
11
|
[](https://www.npmjs.com/package/@sentry/webpack-plugin)
|
|
@@ -63,13 +63,13 @@ Also, check the [example](example) directory.
|
|
|
63
63
|
| Option | Type | Required | Description |
|
|
64
64
|
| ------------------ | ----------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
65
65
|
| include | `string`/`array`/`object` | required | One or more paths that Sentry CLI should scan recursively for sources. It will upload all `.map` files and match associated `.js` files. Each path can be given as an object with path-specific options. See [table below](#include) for details. |
|
|
66
|
-
| org | `string` | optional | The slug of the Sentry organization associated with the app. |
|
|
67
|
-
| project | `string` | optional | The slug of the Sentry project associated with the app. |
|
|
66
|
+
| org | `string` | optional | The slug of the Sentry organization associated with the app. Can also be specified via `process.env.SENTRY_ORG`. |
|
|
67
|
+
| project | `string` | optional | The slug of the Sentry project associated with the app. Can also be specified via `process.env.SENTRY_PROJECT`. |
|
|
68
68
|
| 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). |
|
|
69
69
|
| url | `string` | optional | The base URL of your Sentry instance. Defaults to https://sentry.io/, which is the correct value for SAAS customers. |
|
|
70
70
|
| customHeader | `string` | optional | A header added to all outgoing requests. A string in the format `header-key: header-value` |
|
|
71
71
|
| vcsRemote | `string` | optional | The name of the remote in the version control system. Defaults to `origin`. |
|
|
72
|
-
| release | `string` | optional | Unique identifier for the release. 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 `HEAD`'s commit SHA. (**For `HEAD` option, requires access to `git` CLI and for the root directory to be a valid repository**). |
|
|
72
|
+
| release | `string` | optional | Unique identifier for the release. Can also be specified via `process.env.SENTRY_RELEASE`. 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 `HEAD`'s commit SHA. (**For `HEAD` option, requires access to `git` CLI and for the root directory to be a valid repository**). |
|
|
73
73
|
| dist | `string` | optional | Unique identifier for the distribution, used to further segment your release. Usually your build number. |
|
|
74
74
|
| entries | `array`/`RegExp`/`function(key: string): bool` | optional | Filter for entry points that should be processed. By default, the release will be injected into all entry points. |
|
|
75
75
|
| ignoreFile | `string` | optional | Path to a file containing list of files/directories to ignore. Can point to `.gitignore` or anything with the same format. |
|
|
@@ -107,6 +107,32 @@ Also, check the [example](example) directory.
|
|
|
107
107
|
| sourceMapReference | `boolean` | optional | See above. |
|
|
108
108
|
| rewrite | `boolean` | optional | See above. |
|
|
109
109
|
|
|
110
|
+
Example:
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
const SentryCliPlugin = require('@sentry/webpack-plugin');
|
|
114
|
+
|
|
115
|
+
const config = {
|
|
116
|
+
plugins: [
|
|
117
|
+
new SentryCliPlugin({
|
|
118
|
+
include: [
|
|
119
|
+
{
|
|
120
|
+
paths: ['./packages'],
|
|
121
|
+
urlPrefix: '~/path/to/packages',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
paths: ['./client'],
|
|
125
|
+
urlPrefix: '~/path/to/client',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
ignoreFile: '.sentrycliignore',
|
|
129
|
+
ignore: ['node_modules', 'webpack.config.js'],
|
|
130
|
+
configFile: 'sentry.properties',
|
|
131
|
+
}),
|
|
132
|
+
],
|
|
133
|
+
};
|
|
134
|
+
```
|
|
135
|
+
|
|
110
136
|
#### <a name="setCommits"></a>options.setCommits:
|
|
111
137
|
|
|
112
138
|
| Option | Type | Required | Description |
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"source-map"
|
|
9
9
|
],
|
|
10
10
|
"author": "Sentry",
|
|
11
|
-
"version": "1.
|
|
11
|
+
"version": "1.19.1",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"repository": "git@github.com:getsentry/sentry-webpack-plugin.git",
|
|
14
14
|
"homepage": "https://github.com/getsentry/sentry-webpack-plugin",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"node": ">= 8"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@sentry/cli": "^1.74.4"
|
|
21
|
+
"@sentry/cli": "^1.74.4",
|
|
22
|
+
"webpack-sources": "^2.0.0 || ^3.0.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@types/webpack": "^4.41.31 || ^5.0.0",
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const SentryCli = require('@sentry/cli');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const util = require('util');
|
|
4
|
+
const { RawSource } = require('webpack-sources');
|
|
4
5
|
|
|
5
6
|
const SENTRY_LOADER = path.resolve(__dirname, 'sentry.loader.js');
|
|
6
7
|
const SENTRY_MODULE = path.resolve(__dirname, 'sentry-webpack.module.js');
|
|
@@ -75,23 +76,11 @@ function attachAfterEmitHook(compiler, callback) {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
function attachAfterCodeGenerationHook(compiler, options) {
|
|
79
|
+
// This is only a problem for folks on webpack 3 and below
|
|
78
80
|
if (!compiler.hooks || !compiler.hooks.make) {
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
let webpackSources;
|
|
83
|
-
try {
|
|
84
|
-
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
|
|
85
|
-
webpackSources = require('webpack-sources');
|
|
86
|
-
} catch (_e) {
|
|
87
|
-
// eslint-disable-next-line no-console
|
|
88
|
-
console.warn(
|
|
89
|
-
'Coud not resolve package: webpack-sources. Skipping injection for the remote entry file.'
|
|
90
|
-
);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const { RawSource } = webpackSources;
|
|
95
84
|
const moduleFederationPlugin =
|
|
96
85
|
compiler.options &&
|
|
97
86
|
compiler.options.plugins &&
|
|
@@ -120,7 +109,7 @@ function attachAfterCodeGenerationHook(compiler, options) {
|
|
|
120
109
|
sourceMap.set(
|
|
121
110
|
'javascript',
|
|
122
111
|
new RawSource(
|
|
123
|
-
`${rawSource.source()}
|
|
112
|
+
`${rawSource.source()}
|
|
124
113
|
(function (){
|
|
125
114
|
var globalThis = (typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {});
|
|
126
115
|
globalThis.SENTRY_RELEASES = globalThis.SENTRY_RELEASES || {};
|
|
@@ -260,8 +249,10 @@ class SentryCliPlugin {
|
|
|
260
249
|
* Returns undefined if proposeVersion failed.
|
|
261
250
|
*/
|
|
262
251
|
getReleasePromise() {
|
|
263
|
-
|
|
264
|
-
|
|
252
|
+
const userSpecifiedRelease =
|
|
253
|
+
this.options.release || process.env.SENTRY_RELEASE;
|
|
254
|
+
return (userSpecifiedRelease
|
|
255
|
+
? Promise.resolve(userSpecifiedRelease)
|
|
265
256
|
: this.cli.releases.proposeVersion()
|
|
266
257
|
)
|
|
267
258
|
.then(version => `${version}`.trim())
|
|
@@ -398,6 +389,9 @@ class SentryCliPlugin {
|
|
|
398
389
|
{
|
|
399
390
|
loader: SENTRY_LOADER,
|
|
400
391
|
options: {
|
|
392
|
+
// We check for `process.env.SENTRY_RELEASE` earlier, which is why
|
|
393
|
+
// it's not used here the way `process.env.SENTRY_ORG` and
|
|
394
|
+
// `process.env.SENTRY_PROJECT` are
|
|
401
395
|
releasePromise: this.release,
|
|
402
396
|
org: this.options.org || process.env.SENTRY_ORG,
|
|
403
397
|
project: this.options.project || process.env.SENTRY_PROJECT,
|
|
@@ -570,6 +564,9 @@ class SentryCliPlugin {
|
|
|
570
564
|
}
|
|
571
565
|
|
|
572
566
|
attachAfterCodeGenerationHook(compiler, {
|
|
567
|
+
// We check for `process.env.SENTRY_RELEASE` earlier, which is why it's
|
|
568
|
+
// not used here the way `process.env.SENTRY_ORG` and
|
|
569
|
+
// `process.env.SENTRY_PROJECT` are
|
|
573
570
|
releasePromise: this.release,
|
|
574
571
|
org: this.options.org || process.env.SENTRY_ORG,
|
|
575
572
|
project: this.options.project || process.env.SENTRY_PROJECT,
|